查看商品詳細頁面-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並給予一個動畫尚未開始前的初始值

  •  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

http://easings.net/zh-cn

目前useNativeDriver: true 只support Transform Props 與 opacity

使用Linking

  • 開啟外部連結, mailto://, tel://, http://

  • 開啟電話應用

使用Webview

加入商品詳細

  • 使用 RatingBar 進行收藏

  • yarn add react-native-star-rating

  • 加入放大動畫

加入ImageGallery

  • 疊加兩個Icon箭頭在圖片上方

  • 實作按下箭頭後,圖片會進行更換

  • 加入箭頭的呼吸動畫

加入商品回覆紀錄

  • Layout 練習

Last updated

Was this helpful?