-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
38 lines (31 loc) · 891 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React, {Fragment} from 'react';
import {
SafeAreaView,
Text,
} from 'react-native';
// Flip this bool!
const someCondition = false;
class App extends React.Component {
state = { webValue: null, nativeValue: null }
componentDidMount() {
if(someCondition) {
import('./dynamic-module').then(module => {
// This should work fine in RN
module.reactNative().then(val => this.setState({ nativeValue: val[1] }));
// Following line generates warnings of no reference to localstorage
this.setState({ webValue: module.reactWeb() });
})
}
}
render() {
return (
<Fragment>
<SafeAreaView>
<Text>webValue: { this.state.webValue || 'null' }</Text>
<Text>nativeValue: { this.state.nativeValue || 'null' }</Text>
</SafeAreaView>
</Fragment>
);
}
};
export default App;