this.props.textのテキストを表示するためのコードが以下のようなネイティブコンポーネント(For Eg:myComponent)に反応しました。このテキストの小道具はmyComponentの文字列として定義されています。私はアクションを送信することにより、以下のようにテキストを与えるときReact native:HTML文字列をコンポーネントに渡すと、テキストとして表示される
<Text size='large'
style={styles.text}
textId={this.props.text}
values={this.props.values}>
{this.props.text}
</Text>
、それは私が直接ハードコードした場合、青はリンク
yield put(myComponent.displayAction(displayType,"<Text suppressHighlighting={false} style={{backgroundColor: 'white', textDecorationLine: 'underline', color: 'blue'}} onPress={() => null}>Link</Text>}")
を強調されているように、私はコンポーネントが表示するように期待していString.Butとしてテキストを表示していますmyComponentの文字列、onclickを実行できるLinkを表示しています。
<Text size='large'
style={styles.text}
textId={this.props.text}
values={this.props.values}>
//{this.props.text} => removed this and hardcoded the string below
"<Text suppressHighlighting={false} style={{backgroundColor: 'white', textDecorationLine: 'underline', color: 'blue'}} onPress={() => null}>Link</Text>}"
リンクとしてこれを表示するための任意のヘルプ?
感謝を。私がコードの下に行く場合、コンポーネントからではなくクラスからonPressを処理する方法は? null}> {this.props.text} 、 –
Tutu
@Tutu 'onPress'ハンドラを小道具に渡すこともできます。 – thesbros