Skip to content

Instantly share code, notes, and snippets.

@ThisIsMissEm
Created January 17, 2017 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThisIsMissEm/615d9bbc9813945c9684dfea01f6f176 to your computer and use it in GitHub Desktop.
Save ThisIsMissEm/615d9bbc9813945c9684dfea01f6f176 to your computer and use it in GitHub Desktop.
import React from 'react';
import {
registerComponent,
} from 'react-native-playground';
import {
StatusBar,
Text,
View,
AsyncStorage,
} from 'react-native';
class App extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
result: 'Click the button below to test'
};
this.onPressTrigger = this.onPressTrigger.bind(this);
}
onPressTrigger() {
AsyncStorage.multiSet([]).then(
() => this.setState({ result: 'Success' }),
(err) => this.setState({ result: "Err: " + err.toString() })
);
}
render() {
return (
<View>
<Text>
{this.state.result}
</Text>
<Button
onPress={this.onPressTrigger}
title="Test Storage"
color="#841584"
/>
<StatusBar barStyle="default" />
</View>
);
}
}
registerComponent(App);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment