问题描述
在我的React Native应用程序中,当它启动时,它具有一个启动屏幕,该屏幕在加载第一个屏幕之前以黑色文本显示我的应用程序的“名称”。我想在Android上更改该文本。对于iOS,我知道如何通过Xcode进行操作,但是我不知道如何通过Android进行操作。请注意,我不想创建新的启动屏幕,只想更改现有文本。
解决方法
在此之前,请分享一些代码。请参考。
import React,{ Component } from 'react'
import {
Text,View
} from 'react-native'
export default class reactApp extends Component {
constructor() {
super()
this.state = {
myText: 'My Original Text'
}
}
updateText = () => {
this.setState({myText: 'My Changed Text'})
}
render() {
return (
<View>
<Text onPress = {this.updateText}>
{this.state.myText}
</Text>
</View>
);
}
}