motion-on-native 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -76,14 +76,14 @@ export interface MotionComponentProps {
76
76
  children?: React.ReactNode;
77
77
  }
78
78
  export declare const NativeMotion: {
79
- View: (props: MotionComponentProps & import("react-native").ViewProps) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
80
- Text: (props: MotionComponentProps & import("react-native").TextProps) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
81
- Image: (props: MotionComponentProps & import("react-native").ImageProps) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
82
- ImageBackground: (props: MotionComponentProps & import("react-native").ImageBackgroundProps) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
83
- TextInput: (props: MotionComponentProps & import("react-native").TextInputProps) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
84
- TouchableOpacity: (props: MotionComponentProps & import("react-native").TouchableOpacityProps & React.RefAttributes<View>) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
85
- ScrollView: (props: MotionComponentProps & import("react-native").ScrollViewProps) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
86
- FlatList: (props: MotionComponentProps & import("react-native").FlatListProps<unknown>) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
87
- SectionList: (props: MotionComponentProps & import("react-native").SectionListProps<unknown, unknown>) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
88
- Pressable: (props: MotionComponentProps & import("react-native").PressableProps & React.RefAttributes<View>) => React.ReactElement<import("react-native-reanimated").AnimateProps<any>, string | React.JSXElementConstructor<any>>;
79
+ View: React.ForwardRefExoticComponent<MotionComponentProps & import("react-native").ViewProps & React.RefAttributes<any>>;
80
+ Text: React.ForwardRefExoticComponent<MotionComponentProps & import("react-native").TextProps & React.RefAttributes<any>>;
81
+ Image: React.ForwardRefExoticComponent<MotionComponentProps & import("react-native").ImageProps & React.RefAttributes<any>>;
82
+ ImageBackground: React.ForwardRefExoticComponent<MotionComponentProps & import("react-native").ImageBackgroundProps & React.RefAttributes<any>>;
83
+ TextInput: React.ForwardRefExoticComponent<MotionComponentProps & import("react-native").TextInputProps & React.RefAttributes<any>>;
84
+ TouchableOpacity: React.ForwardRefExoticComponent<Omit<MotionComponentProps & import("react-native").TouchableOpacityProps & React.RefAttributes<View>, "ref"> & React.RefAttributes<any>>;
85
+ ScrollView: React.ForwardRefExoticComponent<MotionComponentProps & import("react-native").ScrollViewProps & React.RefAttributes<any>>;
86
+ FlatList: React.ForwardRefExoticComponent<MotionComponentProps & import("react-native").FlatListProps<unknown> & React.RefAttributes<any>>;
87
+ SectionList: React.ForwardRefExoticComponent<MotionComponentProps & import("react-native").SectionListProps<unknown, unknown> & React.RefAttributes<any>>;
88
+ Pressable: React.ForwardRefExoticComponent<Omit<MotionComponentProps & import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & React.RefAttributes<any>>;
89
89
  };
package/lib/index.js CHANGED
@@ -57,7 +57,7 @@ const DEFAULT_TRANSITION = {
57
57
  repeatType: 'loop',
58
58
  };
59
59
  function createMotionComponent(Component) {
60
- return function MotionComponent(props) {
60
+ return react_1.default.forwardRef((props, ref) => {
61
61
  const { initial = {}, animate = {}, exit = {}, // Future Implementation
62
62
  transition = DEFAULT_TRANSITION, whileHover, // Future Implementation
63
63
  whileTap, // Future Implementation
@@ -247,8 +247,8 @@ function createMotionComponent(Component) {
247
247
  return style;
248
248
  });
249
249
  const AnimatedComponent = react_native_reanimated_1.default.createAnimatedComponent(Component);
250
- return react_1.default.createElement(AnimatedComponent, Object.assign({ style: [styles, animatedStyle] }, rest), children);
251
- };
250
+ return react_1.default.createElement(AnimatedComponent, Object.assign({ ref, style: [styles, animatedStyle] }, rest), children);
251
+ });
252
252
  }
253
253
  function getInitialValue(key, initial) {
254
254
  if (initial === false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-on-native",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Framer Motion-inspired animation library for React Native with Reanimated. Easy spring animations, gestures, and transitions for mobile apps.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",