国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

react-navigation之動態修改title的內容

來源:懂視網 責編:小采 時間:2020-11-27 22:07:07
文檔

react-navigation之動態修改title的內容

react-navigation之動態修改title的內容:本文介紹了react-navigation之動態修改title的內容,分享給大家,具體如下: 效果圖: 動態修改title內容: static navigationOptions = { title: ({ state }) => `Chat with ${state.params.user}` }; ps:
推薦度:
導讀react-navigation之動態修改title的內容:本文介紹了react-navigation之動態修改title的內容,分享給大家,具體如下: 效果圖: 動態修改title內容: static navigationOptions = { title: ({ state }) => `Chat with ${state.params.user}` }; ps:

本文介紹了react-navigation之動態修改title的內容,分享給大家,具體如下:

效果圖:


動態修改title內容:

 static navigationOptions = {
 title: ({ state }) => `Chat with ${state.params.user}`
 };

ps:`Chat with ${state.params.user}` 這里有個注意的地方,是這個符號·而不是單引號‘

index.android.js

/** 
* Sample React Native App 
* https://github.com/facebook/react-native 
* @flow
 */
import {
 AppRegistry,
}from 'react-native';
import rootApp from './js/rootApp'
AppRegistry.registerComponent('GankProject', () = >rootApp);

rootApp.js:

/**
 * Created by Administrator on 2017/3/31 0031. 
*/
'use strict'import React from 'react';
import {
 AppRegistry,
 Text,
 View,
 Button,
}
from 'react-native';
import {
 StackNavigator
}
from 'react-navigation';
import ChatScreen from './ChatScreen';
class HomeScreen extends React.Component {
 static navigationOptions = {
 title: 'Welcome',
 //設置標題內容 }; 
 render() {
 const {
 navigate
 } = this.props.navigation;
 return ( < View > <Text > Hello, Navigation ! </Text> 
 <Button 
 onPress={() => navigate('Chat',{user:'Lucy'})} 
 title="Chat with Lucy"/ > </View> 
 ); 
 }
} 
const SimpleApp = StackNavigator(
{ 
 Home: {screen: HomeScreen}, 
 Chat:{screen:ChatScreen}, 
}
); 
export default SimpleApp;

ChatScreen.js:

/**
 * Created by Administrator on 2017/3/31 0031. 
*/
'use strict'
import React,{Component}from 'react';
import {View,Text}from 'react-native';
class ChatScreen extends Component {
 static navigationOptions = {
 title: ({state}) = >`Chat with $ {state.params.user}`
 };
 render() {
 const {params} = this.props.navigation.state;
 return ( < View > <Text > Chat with {
 params.user
 } < /Text> </View > );
 }
}
export default ChatScreen;

效果2:


/** * Created by Administrator on 2017/3/31 0031. */
'use strict'
import React, { Component}from 'react';
import {View, Text, Button}from 'react-native';
class ChatScreen extends Component {
 static navigationOptions = {
 title: ({
 state
 }) => {
 if (state.params.mode === 'info') {
 return `${state.params.user}'s Contact Info`;
 }
 return `Chat with ${state.params.user}`;
 },
 header: ({state, setParams}) => {
 // The navigation prop has functions like setParams, goBack, and navigate. 
 let right = ( < Button title = {
 `${state.params.user}'s info`
 }
 onPress = {
 () => setParams({
 mode: 'info'
 })
 }
 /> 
 ); 
 if (state.params.mode === 'info') { 
 right = ( 
 <Button 
 title="Done" 
 onPress={() => setParams({ mode: 'none' })} 
 / >
 );
 }
 return {right};
 },
};
render() {
 const {
 params
 } = this.props.navigation.state;
 return ( 
 < View >
 < Text > Chat with {params.user} < /Text> 
 </View >
 );
}
}
export default ChatScreen;

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

react-navigation之動態修改title的內容

react-navigation之動態修改title的內容:本文介紹了react-navigation之動態修改title的內容,分享給大家,具體如下: 效果圖: 動態修改title內容: static navigationOptions = { title: ({ state }) => `Chat with ${state.params.user}` }; ps:
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 亚洲国产精品久久久久 | 国产精品香蕉 | 俄罗斯女人禽交zozo | 精品一区二区三区四区电影 | 最刺激黄a大片免费观看 | 国产一区二区三区在线 | 欧美亚洲综合图区在线 | 最新国产精品视频 | 黄动漫3d无遮挡免费观看 | 欧美一区二区二区 | 毛片视频网址 | 国产成人久久蜜一区二区 | 国产免费小视频在线观看 | 亚洲视频在线观看视频 | 国产日韩欧美视频在线 | 日韩免费一区二区三区在线 | 精品国产免费人成在线观看 | 欧美综合第一页 | 欧美视频亚洲色图 | 在线播放一区 | 国产精品综合一区二区 | 日本国产一区二区三区 | 亚洲日本韩国在线 | 久久综合中文字幕一区二区 | 在线观看网站国产 | 亚洲精品午夜国产va久久成人 | 精品一区二区三区四区五区六区 | 99精品欧美一区二区三区综合在线 | 亚洲欧美日韩在线 | 日韩经典第一页 | 日韩另类在线 | 成人精品视频一区二区在线 | 国产亚洲一欧美一区二区三区 | 欧美色视频在线 | 91精品国产91久久久久福利 | 久久精品国产99久久99久久久 | 日韩中文字幕a | 欧美激情在线精品一区二区 | 亚洲欧美日韩另类 | 亚洲国产精品一区二区九九 | 国产精品一区二区午夜嘿嘿嘿小说 |