Merge pull request #436 from realm/sk-react-native-25

Updates for React Native 0.25
This commit is contained in:
Scott Kyle 2016-05-16 14:22:59 -07:00
commit 9370eba229
15 changed files with 86 additions and 42 deletions

View File

@ -18,10 +18,13 @@
'use strict';
import React, {
import React from 'react';
import {
Component,
Navigator,
StatusBarIOS,
Platform,
StatusBar,
Text,
TouchableOpacity,
View,
@ -60,8 +63,8 @@ export default class TodoApp extends Component {
}
componentWillMount() {
if (StatusBarIOS) {
StatusBarIOS.setStyle('light-content');
if (Platform.OS == 'ios') {
StatusBar.setBarStyle('light-content');
}
}

View File

@ -18,7 +18,9 @@
'use strict';
import React, {
import React from 'react';
import {
Text,
TouchableWithoutFeedback,
View,

View File

@ -18,7 +18,9 @@
'use strict';
import React, {
import React from 'react';
import {
Platform,
Text,
TextInput,

View File

@ -18,7 +18,9 @@
'use strict';
import React, {
import React from 'react';
import {
Text,
View,
} from 'react-native';

View File

@ -6,8 +6,8 @@
"start": "react-native start"
},
"dependencies": {
"react": "^0.14.5",
"react-native": "^0.24.1",
"react": "^0.14.8",
"react-native": "^0.25.1",
"realm": "file:../.."
}
}

View File

@ -17,8 +17,10 @@
////////////////////////////////////////////////////////////////////////////
'use strict';
import React, {
AppRegistry,
import React from 'react';
import {
Component,
StyleSheet,
Text,
@ -27,9 +29,9 @@ import React, {
TouchableHighlight
} from 'react-native';
const Store = require('react-native-store');
const SQLite = require('react-native-sqlite-storage');
const Realm = require('realm');
import Store from 'react-native-store';
import SQLite from 'react-native-sqlite-storage';
import Realm from 'realm';
// Make SQLite module use Promises.
SQLite.enablePromise(true);
@ -353,7 +355,7 @@ class RNSqliteTests extends Tests {
const apiTests = [new RealmTests, new RNSqliteTests, new RNStoreTests];
class ReactNativeBenchmarks extends Component {
export default class ReactNativeBenchmarks extends Component {
constructor(props) {
super(props);
@ -497,5 +499,3 @@ const styles = StyleSheet.create({
fontSize: 12
}
});
module.exports = ReactNativeBenchmarks;

View File

@ -1,8 +1,24 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
'use strict';
import React, {
AppRegistry
} from 'react-native';
const ReactNativeBenchmarks = require('./benchmarks');
import { AppRegistry } from 'react-native';
import ReactNativeBenchmarks from './benchmarks';
AppRegistry.registerComponent('ReactNativeBenchmarks', () => ReactNativeBenchmarks);
AppRegistry.registerComponent('ReactNativeBenchmarks', () => ReactNativeBenchmarks);

View File

@ -1,8 +1,24 @@
'use strict';
import React, {
AppRegistry
} from 'react-native';
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
const ReactNativeBenchmarks = require('./benchmarks');
'use strict';
import { AppRegistry } from 'react-native';
import ReactNativeBenchmarks from './benchmarks';
AppRegistry.registerComponent('ReactNativeBenchmarks', () => ReactNativeBenchmarks);

View File

@ -6,8 +6,8 @@
"start": "react-native start"
},
"dependencies": {
"react": "^0.14.5",
"react-native": "^0.24.1",
"react": "^0.14.8",
"react-native": "^0.25.1",
"react-native-sqlite-storage": "^2.1.3",
"react-native-store": "^0.4.1",
"realm": "file:../.."

View File

@ -18,4 +18,6 @@
'use strict';
exports.ListView = require('./listview');
import ListView from './listview';
export { ListView };

View File

@ -18,7 +18,8 @@
'use strict';
const React = require('react-native');
import React from 'react';
import { ListView as BaseListView } from 'react-native';
function hashObjects(array) {
let hash = Object.create(null);
@ -28,7 +29,7 @@ function hashObjects(array) {
return hash;
}
class ListViewDataSource extends React.ListView.DataSource {
class ListViewDataSource extends BaseListView.DataSource {
cloneWithRowsAndSections(inputData, sectionIds, rowIds) {
let data = {};
@ -160,7 +161,7 @@ class ListViewDataSource extends React.ListView.DataSource {
}
}
class ListView extends React.Component {
export default class ListView extends React.Component {
constructor(props) {
super(props);
@ -169,7 +170,7 @@ class ListView extends React.Component {
render() {
return (
<React.ListView {...this.props} ref="listView" renderRow={this.renderRow} />
<BaseListView {...this.props} ref="listView" renderRow={this.renderRow} />
);
}
@ -200,5 +201,3 @@ ListView.propTypes = {
};
ListView.DataSource = ListViewDataSource;
module.exports = ListView;

View File

@ -111,10 +111,12 @@ module.exports = {
},
isNode: function() {
// eslint-disable-next-line no-undef
return typeof process == 'object' && Object.prototype.toString.call(process) == '[object process]';
},
isNode6: function() {
// eslint-disable-next-line no-undef
return this.isNode() && process.version.indexOf('v6.') == 0;
},
};

View File

@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////
'use strict';
const React = require('react-native');
const React = require('react');
const Realm = require('realm');
const RealmTests = require('realm-tests');
const builder = require('xmlbuilder');
@ -30,7 +30,7 @@ const {
Text,
View,
TouchableNativeFeedback,
} = React;
} = require('react-native');
RealmTests.registerTests({
ListViewTest: require('./tests/listview-test'),

View File

@ -18,7 +18,7 @@
'use strict';
const React = require('react-native');
const React = require('react');
const Realm = require('realm');
const tests = require('./tests');
@ -28,7 +28,7 @@ const {
Text,
TouchableHighlight,
View,
} = React;
} = require('react-native');
class ReactTests extends React.Component {
render() {

View File

@ -6,8 +6,8 @@
"start": "react-native start"
},
"dependencies": {
"react": "^0.14.5",
"react-native": "^0.24.1",
"react": "^0.14.8",
"react-native": "^0.25.1",
"react-native-fs": "^1.1.0",
"xmlbuilder": "^4.2.1",
"realm": "file:../..",