This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { createElement } from 'react-native-web'; | |
const Option = ({ | |
label, | |
value, | |
}) => createElement('option', { | |
children: label, | |
value, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
const path = require('path'); | |
const fs = require('fs'); | |
const fsx = require('fs-extra'); | |
const glob = require('glob'); | |
const getPlatformDirName = isNative => isNative ? '__native_snapshots__' : '__web_snapshots__'; | |
const getOtherPlatformDirName = isNative => isNative ? '__web_snapshots__' : '__native_snapshots__'; | |
const ensureFolder = dir => !fs.existsSync(dir) && fs.mkdirSync(dir); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Picker } from 'react-native'; | |
export const NativePicker = ({ | |
style, | |
currentValue, | |
onChange, | |
options, | |
}) => ( | |
<Picker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HelloReact = () => ( | |
<div> | |
<p>Hello React</p> | |
</div> | |
); | |
const HelloReactNative = () => ( | |
<View> | |
<Text>Hello ReactNative</Text> | |
</View> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Platform } from 'react-native'; | |
const isWeb = Platform.OS === 'web'; | |
const isNative = !isWeb; | |
const isIos = Platform.OS === 'ios'; | |
const isAndroid = Platform.OS === 'android'; | |
const isDesktop = isWeb && typeof matchMedia !== 'undefined' && matchMedia('(min-width: 768px)').matches; | |
const isMobile = !isDesktop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createState = require("jstates"); | |
const myState = createState({ counter: 0 }); | |
function onUpdate(state) { | |
console.log("onUpdate: counter =", state.counter); | |
} | |
myState.subscribe(onUpdate); | |
myState.setState(state => ({ counter: ++state.counter })); |
OlderNewer