Compare commits

..

7 Commits
0.1.4 ... 0.1.6

Author SHA1 Message Date
Nicolas Gallagher
5dd414f9aa 0.1.6 2017-10-05 19:05:13 -07:00
Louis Lagrange
72c72f6530 [fix] AsyncStorage.flushGetRequests
Add stub function for API compatibility.

Close #676
2017-10-05 19:03:43 -07:00
Nicolas Gallagher
de970f9dbb Add more tests for Switch 2017-10-05 13:59:59 -07:00
Nicolas Gallagher
e8d6c5b4dd Helper function for ActivityIndicator SVGs 2017-10-05 13:59:42 -07:00
Tiaan
e91a5ae13e Add missing comma to example webpack config
Close #671
2017-10-04 11:54:22 -07:00
Nicolas Gallagher
b08bfb9ad5 0.1.5 2017-10-04 11:49:22 -07:00
Nicolas Gallagher
5353011ee4 [fix] BackHandler export; remove BackAndroid
Fix #673
2017-10-04 11:45:28 -07:00
8 changed files with 34 additions and 40 deletions

View File

@@ -7,7 +7,7 @@ const getDistLocation = importName => {
case 'AppRegistry':
case 'AppState':
case 'AsyncStorage':
case 'BackAndroid':
case 'BackHandler':
case 'Clipboard':
case 'Dimensions':
case 'Easing':

View File

@@ -36,7 +36,7 @@ const babelLoaderConfiguration = {
cacheDirectory: true,
// This aliases 'react-native' to 'react-native-web' and includes only
// the modules needed by the app
plugins: ['react-native-web/babel']
plugins: ['react-native-web/babel'],
// The 'react-native' preset is recommended (or use your own .babelrc)
presets: ['react-native']
}

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-web",
"version": "0.1.4",
"version": "0.1.6",
"description": "React Native for Web",
"main": "dist/index.js",
"module": "dist/module.js",

View File

@@ -61,6 +61,11 @@ export default class AsyncStorage {
}, callback);
}
/**
* (stub) Flushes any pending requests using a single batch call to get the data.
*/
static flushGetRequests() {}
/**
* Gets *all* keys known to the app, for all callers, libraries, etc.
*/

View File

@@ -12,7 +12,7 @@
function emptyFunction() {}
const BackAndroid = {
const BackHandler = {
exitApp: emptyFunction,
addEventListener() {
return {
@@ -22,4 +22,4 @@ const BackAndroid = {
removeEventListener: emptyFunction
};
export default BackAndroid;
export default BackHandler;

View File

@@ -17,6 +17,10 @@ import ViewPropTypes from '../View/ViewPropTypes';
import { bool, number, oneOf, oneOfType, string } from 'prop-types';
import React, { Component } from 'react';
const createSvgCircle = style => (
<circle cx="16" cy="16" fill="none" r="14" strokeWidth="4" style={style} />
);
class ActivityIndicator extends Component {
static displayName = 'ActivityIndicator';
@@ -40,29 +44,15 @@ class ActivityIndicator extends Component {
const svg = (
<svg height="100%" viewBox="0 0 32 32" width="100%">
<circle
cx="16"
cy="16"
fill="none"
r="14"
strokeWidth="4"
style={{
stroke: color,
opacity: 0.2
}}
/>
<circle
cx="16"
cy="16"
fill="none"
r="14"
strokeWidth="4"
style={{
stroke: color,
strokeDasharray: 80,
strokeDashoffset: 60
}}
/>
{createSvgCircle({
stroke: color,
opacity: 0.2
})}
{createSvgCircle({
stroke: color,
strokeDasharray: 80,
strokeDashoffset: 60
})}
</svg>
);

View File

@@ -19,21 +19,21 @@ describe('components/Switch', () => {
});
});
/*
describe('onValueChange', () => {
test('when value is "false" it receives "true"', () => {
const handleValueChange = (value) => expect(value === true).toBeTruthy();
const component = shallow(<Switch onValueChange={handleValueChange} value={false} />);
component.find('input').simulate('click');
const onValueChange = jest.fn();
const component = shallow(<Switch onValueChange={onValueChange} value={false} />);
component.find('input').simulate('change', { nativeEvent: { target: { checked: true } } });
expect(onValueChange).toHaveBeenCalledWith(true)
});
test('when value is "true" it receives "false"', () => {
const handleValueChange = (value) => expect(value === false).toBeTruthy();
const component = shallow(<Switch onValueChange={handleValueChange} value />);
component.find('input').simulate('click');
const onValueChange = jest.fn();
const component = shallow(<Switch onValueChange={onValueChange} value />);
component.find('input').simulate('change', { nativeEvent: { target: { checked: false } } });
expect(onValueChange).toHaveBeenCalledWith(false)
});
});
*/
describe('value', () => {
test('when "false" an unchecked checkbox is rendered', () => {

View File

@@ -9,7 +9,7 @@ import Animated from './apis/Animated';
import AppRegistry from './apis/AppRegistry';
import AppState from './apis/AppState';
import AsyncStorage from './apis/AsyncStorage';
import BackAndroid from './apis/BackAndroid';
import BackHandler from './apis/BackHandler';
import Clipboard from './apis/Clipboard';
import Dimensions from './apis/Dimensions';
import Easing from './apis/Easing';
@@ -73,7 +73,7 @@ export {
AppRegistry,
AppState,
AsyncStorage,
BackAndroid,
BackHandler,
Clipboard,
Dimensions,
Easing,
@@ -138,8 +138,7 @@ const ReactNative = {
AppRegistry,
AppState,
AsyncStorage,
BackAndroid,
BackHandler: BackAndroid,
BackHandler,
Clipboard,
Dimensions,
Easing,