查看商品詳細頁面-MerchandiseDetail
Animations
將要做動畫的元件用Animated.View 進行包裝
Animated, Easing } from 'react-native'; .... <Animated.View style={[scaleAnimation]}> <Icon size={56} color="#777" name="arrow-right" /> </Animated.View>
設定Animated.Value並給予一個動畫尚未開始前的初始值
Animated.Value並給予一個動畫尚未開始前的初始值state = { scaleAnimatedValue: new Animated.Value(1) };
動畫的描述模型
timing
以duration 與 toValue, easing 型態 描述
decay
以velocity 與 acceleration 描述
const toBig = Animated.timing(this.state.scaleAnimatedValue, { duration: DURATION, easing: Easing.linear, toValue: 1.3 });
對動畫進行行為疊加 (Parallel, Sequence, Loop) 並執行動畫
將Animated.Value 綁定至要進行動畫的Layout / Transform Props
常見錯誤:
Attempted to assign readonly property animation
transform 拼錯,系統找不到此
property
參考資料:
https://facebook.github.io/react-native/docs/transforms.html#transform
https://www.jianshu.com/p/b3cfc6b0c33f
目前useNativeDriver: true 只support Transform Props 與 opacity
使用Linking
開啟外部連結, mailto://, tel://, http://
開啟電話應用
使用Webview
使用
baseUrl: ''避免亂碼 (hack) react-native ^0.53 解決監聽Webview 的url 變更
onNavigationStateChange點擊連結時開啟系統browser,使用
Linking.openURL必須寫定Webview 的 height 造成layout 的 不方便,無法根據內容做高的動態調整
* 當html 獲得後,計算高度,並動態決定webview 的 height
加入商品詳細
使用 RatingBar 進行收藏
yarn add react-native-star-rating
加入放大動畫
加入ImageGallery
疊加兩個Icon箭頭在圖片上方
實作按下箭頭後,圖片會進行更換
加入箭頭的呼吸動畫
加入商品回覆紀錄
Layout 練習
Last updated
Was this helpful?