-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is React Native supported? #44
Comments
@yaronlevi However, I wonder if the answer was given to you as the next example using It is a method using setState and import React from 'react';
import { SceneItem } from "scenejs";
import { Text } from 'react-native';
export default class Example1 extends React.Component {
state = {
styles: { opacity: 0 },
}
render() {
return (
<Text style={this.state.styles}>
Example1
</Text>
);
}
componentDidMount() {
new SceneItem({
0: {
opacity: 0,
fontSize: 0,
},
3: {
opacity: 1,
fontSize: 20,
},
}).on("animate", e => {
// animate event in SceneItem uses frame property.
this.setState({
styles: e.frame.get(),
});
}).play();
}
} |
import React from 'react';
import Scene from "scenejs";
import { View, Text } from 'react-native';
export default class Example2 extends React.Component {
state = {
styles: {
text1: { opacity: 0 },
text2: { opacity: 0 },
},
};
render() {
const styles = this.state.styles;
return (
<View>
<Text style={styles.text1}>
Example2
</Text>
<Text style={styles.text2}>
Width text
</Text>
</View>
);
}
componentDidMount() {
new Scene({
text1: {
0: {
opacity: 0,
fontSize: 0,
},
3: {
opacity: 1,
fontSize: 20,
},
},
text2: {
0: {
width: 50, height: 50, backgroundColor: 'powderblue'
},
3: {
width: 300, height: 100,
}
}
}).on("animate", e => {
// animate event in Scene uses frames property.
const frames = e.frames;
this.setState({
styles: {
text1: frames.text1.get(),
text2: frames.text2.get(),
},
});
}).play();
}
} |
No description provided.
The text was updated successfully, but these errors were encountered: