From 7bb12d61c0189b3160c33f91991431689d43f070 Mon Sep 17 00:00:00 2001 From: Tomasz Sapeta Date: Mon, 15 Nov 2021 15:48:38 +0100 Subject: [PATCH] [linear-gradient][ios] Rewrite entire module to Swift (#15168) --- apps/bare-expo/ios/Podfile.lock | 14 +-- .../unversioned/expo-linear-gradient.json | 2 +- ios/Podfile.lock | 12 +- packages/expo-linear-gradient/CHANGELOG.md | 2 + .../build/LinearGradient.d.ts | 3 + .../build/LinearGradient.js.map | 2 +- .../ios/EXLinearGradient/EXLinearGradient.h | 12 -- .../ios/EXLinearGradient/EXLinearGradient.m | 53 --------- .../EXLinearGradient/EXLinearGradientLayer.h | 14 --- .../EXLinearGradient/EXLinearGradientLayer.m | 110 ------------------ .../EXLinearGradientManager.h | 8 -- .../EXLinearGradientManager.m | 45 ------- .../LinearGradientModule.swift | 29 ----- ...ent.podspec => ExpoLinearGradient.podspec} | 6 +- .../ios/LinearGradientLayer.swift | 101 ++++++++++++++++ .../ios/LinearGradientModule.swift | 32 +++++ .../ios/LinearGradientView.swift | 13 +++ .../src/LinearGradient.tsx | 3 + packages/expo-linear-gradient/unimodule.json | 4 - .../ios/Swift/Conversions.swift | 2 + 20 files changed, 174 insertions(+), 293 deletions(-) delete mode 100644 packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradient.h delete mode 100644 packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradient.m delete mode 100644 packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientLayer.h delete mode 100644 packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientLayer.m delete mode 100644 packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientManager.h delete mode 100644 packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientManager.m delete mode 100644 packages/expo-linear-gradient/ios/EXLinearGradient/LinearGradientModule.swift rename packages/expo-linear-gradient/ios/{EXLinearGradient.podspec => ExpoLinearGradient.podspec} (87%) create mode 100644 packages/expo-linear-gradient/ios/LinearGradientLayer.swift create mode 100644 packages/expo-linear-gradient/ios/LinearGradientModule.swift create mode 100644 packages/expo-linear-gradient/ios/LinearGradientView.swift delete mode 100644 packages/expo-linear-gradient/unimodule.json diff --git a/apps/bare-expo/ios/Podfile.lock b/apps/bare-expo/ios/Podfile.lock index 5e9496191dad7f..cdd2d00ac9ebc5 100644 --- a/apps/bare-expo/ios/Podfile.lock +++ b/apps/bare-expo/ios/Podfile.lock @@ -102,8 +102,6 @@ PODS: - EXJSONUtils (0.2.0) - EXKeepAwake (10.0.0): - ExpoModulesCore - - EXLinearGradient (10.0.1): - - ExpoModulesCore - EXLocalAuthentication (12.0.0): - ExpoModulesCore - EXLocalization (11.0.0): @@ -211,6 +209,8 @@ PODS: - ExpoModulesCore - ExpoHaptics (11.0.1): - ExpoModulesCore + - ExpoLinearGradient (10.0.1): + - ExpoModulesCore - ExpoModulesCore (0.4.2): - React-Core - ReactCommon/turbomodule/core @@ -802,7 +802,6 @@ DEPENDENCIES: - EXInAppPurchases (from `../../../packages/expo-in-app-purchases/ios`) - EXJSONUtils (from `../../../packages/expo-json-utils/ios`) - EXKeepAwake (from `../../../packages/expo-keep-awake/ios`) - - EXLinearGradient (from `../../../packages/expo-linear-gradient/ios`) - EXLocalAuthentication (from `../../../packages/expo-local-authentication/ios`) - EXLocalization (from `../../../packages/expo-localization/ios`) - EXLocation (from `../../../packages/expo-location/ios`) @@ -823,6 +822,7 @@ DEPENDENCIES: - expo-dev-menu/UITests (from `../../../packages/expo-dev-menu`) - ExpoCellular (from `../../../packages/expo-cellular/ios`) - ExpoHaptics (from `../../../packages/expo-haptics/ios`) + - ExpoLinearGradient (from `../../../packages/expo-linear-gradient/ios`) - ExpoModulesCore (from `../../../packages/expo-modules-core/ios`) - ExpoSystemUI (from `../../../packages/expo-system-ui/ios`) - EXPrint (from `../../../packages/expo-print/ios`) @@ -1041,9 +1041,6 @@ EXTERNAL SOURCES: EXKeepAwake: inhibit_warnings: false :path: "../../../packages/expo-keep-awake/ios" - EXLinearGradient: - inhibit_warnings: false - :path: "../../../packages/expo-linear-gradient/ios" EXLocalAuthentication: inhibit_warnings: false :path: "../../../packages/expo-local-authentication/ios" @@ -1088,6 +1085,9 @@ EXTERNAL SOURCES: ExpoHaptics: inhibit_warnings: false :path: "../../../packages/expo-haptics/ios" + ExpoLinearGradient: + inhibit_warnings: false + :path: "../../../packages/expo-linear-gradient/ios" ExpoModulesCore: inhibit_warnings: false :path: "../../../packages/expo-modules-core/ios" @@ -1290,7 +1290,6 @@ SPEC CHECKSUMS: EXInAppPurchases: a981bef8aea038e9c4b036f75a6aef73cc723eca EXJSONUtils: f515cf71710855d7ba5bfc6752af3b9a6f6aad01 EXKeepAwake: 8aa32396a5972d26e75e538603aad0f032396503 - EXLinearGradient: cac7d90c8b8112736a7630cbd7d9dc242e7b075b EXLocalAuthentication: 4c640e20a308d66224468661a0da434f86435283 EXLocalization: bb38414618b30a177482c9a6f5594ec6eb0898c1 EXLocation: 6d13fb1d4b65ed1b2d2bdd0b0f11417cc0a2656a @@ -1307,6 +1306,7 @@ SPEC CHECKSUMS: expo-dev-menu-interface: 273c68c2c30ecbc70af2903dfb3821f567ef9d78 ExpoCellular: 90940614d45df5b31f281d70a63d92a06fe44af4 ExpoHaptics: c0c014eabfdd1353a908f857f168b01fafd526db + ExpoLinearGradient: 841746b0ef9c771d1f37fa5463f39eb25b6aae77 ExpoModulesCore: daacb24b99b77ec28c0cbc877a574b1f8e6709c9 ExpoSystemUI: 3c969e3db290fcd5edb9c466d585f183d934b421 EXPrint: a224501bbb89072567c58a5127f2d125b8776ea2 diff --git a/docs/public/static/data/unversioned/expo-linear-gradient.json b/docs/public/static/data/unversioned/expo-linear-gradient.json index 372be8c5f631b1..5c83b27011033a 100644 --- a/docs/public/static/data/unversioned/expo-linear-gradient.json +++ b/docs/public/static/data/unversioned/expo-linear-gradient.json @@ -1 +1 @@ -{"name":"expo-linear-gradient","kind":1,"kindString":"Project","originalName":"","children":[{"name":"LinearGradient","kind":128,"kindString":"Class","comment":{"shortText":"Renders a native view that transitions between multiple colors in a linear direction."},"children":[{"name":"constructor","kind":512,"kindString":"Constructor","signatures":[{"name":"new LinearGradient","kind":16384,"kindString":"Constructor signature","parameters":[{"name":"props","kind":32768,"kindString":"Parameter","type":{"type":"union","types":[{"type":"reference","name":"LinearGradientProps"},{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}]}}],"type":{"type":"reference","name":"LinearGradient"},"inheritedFrom":{"type":"reference","name":"React.Component.constructor"}},{"name":"new LinearGradient","kind":16384,"kindString":"Constructor signature","comment":{"tags":[{"tag":"deprecated","text":""},{"tag":"see","text":"https://reactjs.org/docs/legacy-context.html\n"}]},"parameters":[{"name":"props","kind":32768,"kindString":"Parameter","type":{"type":"reference","name":"LinearGradientProps"}},{"name":"context","kind":32768,"kindString":"Parameter","type":{"type":"intrinsic","name":"any"}}],"type":{"type":"reference","name":"LinearGradient"},"inheritedFrom":{"type":"reference","name":"React.Component.constructor"}}],"inheritedFrom":{"type":"reference","name":"React.Component.constructor"}},{"name":"context","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"shortText":"If using the new style context, re-declare this in your class to be the\n`React.ContextType` of your `static contextType`.\nShould be used with type annotation or static contextType.","text":"```ts\nstatic contextType = MyContext\n// For TS pre-3.7:\ncontext!: React.ContextType\n// For TS 3.7 and above:\ndeclare context: React.ContextType\n```\n","tags":[{"tag":"see","text":"https://reactjs.org/docs/context.html\n"}]},"type":{"type":"intrinsic","name":"any"},"inheritedFrom":{"type":"reference","name":"React.Component.context"}},{"name":"props","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"type":{"type":"intersection","types":[{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"},{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","children":[{"name":"children","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"ReactNode"}}]}}],"name":"Readonly"}]},"inheritedFrom":{"type":"reference","name":"React.Component.props"}},{"name":"refs","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"tags":[{"tag":"deprecated","text":"\nhttps://reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs\n"}]},"type":{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","indexSignature":{"name":"__index","kind":8192,"kindString":"Index signature","parameters":[{"name":"key","kind":32768,"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"ReactInstance"}}}},"inheritedFrom":{"type":"reference","name":"React.Component.refs"}},{"name":"state","kind":1024,"kindString":"Property","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal"}}],"name":"Readonly"},"inheritedFrom":{"type":"reference","name":"React.Component.state"}},{"name":"contextType","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isOptional":true},"comment":{"shortText":"If set, `this.context` will be set at runtime to the current value of the given Context.","text":"Usage:\n\n```ts\ntype MyContext = number\nconst Ctx = React.createContext(0)\n\nclass Foo extends React.Component {\n static contextType = Ctx\n context!: React.ContextType\n render () {\n return <>My context's value: {this.context};\n }\n}\n```\n","tags":[{"tag":"see","text":"https://reactjs.org/docs/context.html#classcontexttype\n"}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"any"}],"name":"Context"},"inheritedFrom":{"type":"reference","name":"React.Component.contextType"}},{"name":"UNSAFE_componentWillMount","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"UNSAFE_componentWillMount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before mounting occurs, and before `Component#render`.\nAvoid introducing any side-effects or subscriptions in this method.","text":"This method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use componentDidMount or the constructor instead"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillMount"}}],"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillMount"}},{"name":"UNSAFE_componentWillReceiveProps","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"UNSAFE_componentWillReceiveProps","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called when the component may be receiving new props.\nReact may call this even if props have not changed, so be sure to compare new and existing\nprops if you only want to handle changes.","text":"Calling `Component#setState` generally does not trigger this method.\n\nThis method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use static getDerivedStateFromProps instead"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillReceiveProps"}}],"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillReceiveProps"}},{"name":"UNSAFE_componentWillUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"UNSAFE_componentWillUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before rendering when new props or state is received. Not called for the initial render.","text":"Note: You cannot call `Component#setState` here.\n\nThis method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use getSnapshotBeforeUpdate instead"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillUpdate"}},{"name":"componentDidCatch","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentDidCatch","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Catches exceptions generated in descendant components. Unhandled exceptions will cause\nthe entire component tree to unmount."},"parameters":[{"name":"error","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error"}},{"name":"errorInfo","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"ErrorInfo"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentDidCatch"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentDidCatch"}},{"name":"componentDidMount","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentDidMount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately after a component is mounted. Setting state here will trigger re-rendering."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentDidMount"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentDidMount"}},{"name":"componentDidUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentDidUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately after updating occurs. Not called for the initial render.","text":"The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.\n"},"parameters":[{"name":"prevProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"prevState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"snapshot","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentDidUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentDidUpdate"}},{"name":"componentWillMount","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentWillMount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before mounting occurs, and before `Component#render`.\nAvoid introducing any side-effects or subscriptions in this method.","text":"Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use componentDidMount or the constructor instead; will stop working in React 17"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentWillMount"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentWillMount"}},{"name":"componentWillReceiveProps","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentWillReceiveProps","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called when the component may be receiving new props.\nReact may call this even if props have not changed, so be sure to compare new and existing\nprops if you only want to handle changes.","text":"Calling `Component#setState` generally does not trigger this method.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use static getDerivedStateFromProps instead; will stop working in React 17"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentWillReceiveProps"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentWillReceiveProps"}},{"name":"componentWillUnmount","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentWillUnmount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as\ncancelled network requests, or cleaning up any DOM elements created in `componentDidMount`."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentWillUnmount"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentWillUnmount"}},{"name":"componentWillUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentWillUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before rendering when new props or state is received. Not called for the initial render.","text":"Note: You cannot call `Component#setState` here.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentWillUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentWillUpdate"}},{"name":"forceUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true},"signatures":[{"name":"forceUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"name":"callback","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"signatures":[{"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.forceUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.forceUpdate"}},{"name":"getSnapshotBeforeUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"getSnapshotBeforeUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Runs before React applies the result of `render` to the document, and\nreturns an object to be given to componentDidUpdate. Useful for saving\nthings such as scroll position before `render` causes changes to it.","text":"Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated\nlifecycle events from running.\n"},"parameters":[{"name":"prevProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"prevState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}}],"type":{"type":"intrinsic","name":"any"},"inheritedFrom":{"type":"reference","name":"React.Component.getSnapshotBeforeUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.getSnapshotBeforeUpdate"}},{"name":"render","kind":2048,"kindString":"Method","signatures":[{"name":"render","kind":4096,"kindString":"Call signature","type":{"type":"reference","name":"Element"},"overwrites":{"type":"reference","name":"React.Component.render"}}],"overwrites":{"type":"reference","name":"React.Component.render"}},{"name":"setState","kind":2048,"kindString":"Method","flags":{"isExternal":true},"signatures":[{"name":"setState","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"typeParameter":[{"name":"K","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"never"}}],"parameters":[{"name":"state","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}},{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"signatures":[{"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"name":"prevState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"props","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}},{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}},{"type":"reference","name":"K"}],"name":"Pick"}]}}]}},{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}},{"type":"reference","name":"K"}],"name":"Pick"}]}},{"name":"callback","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"signatures":[{"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.setState"}}],"inheritedFrom":{"type":"reference","name":"React.Component.setState"}},{"name":"shouldComponentUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"shouldComponentUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called to determine whether the change in props and state should trigger a re-render.","text":"`Component` always returns true.\n`PureComponent` implements a shallow comparison on props and state and returns true if any\nprops or states have changed.\n\nIf false is returned, `Component#render`, `componentWillUpdate`\nand `componentDidUpdate` will not be called.\n"},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"React.Component.shouldComponentUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.shouldComponentUpdate"}}],"extendedTypes":[{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Component"}]},{"name":"LinearGradientPoint","kind":4194304,"kindString":"Type alias","comment":{"shortText":"An object `{ x: number; y: number }` or array `[x, y]` that represents the point\nat which the gradient starts or ends, as a fraction of the overall size of the gradient ranging\nfrom `0` to `1`, inclusive."},"type":{"type":"union","types":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","children":[{"name":"x","kind":1024,"kindString":"Property","comment":{"shortText":"A number ranging from `0` to `1`, representing the position of gradient transformation."},"type":{"type":"intrinsic","name":"number"}},{"name":"y","kind":1024,"kindString":"Property","comment":{"shortText":"A number ranging from `0` to `1`, representing the position of gradient transformation."},"type":{"type":"intrinsic","name":"number"}}]}},{"type":"reference","name":"NativeLinearGradientPoint"}]}},{"name":"LinearGradientProps","kind":4194304,"kindString":"Type alias","type":{"type":"intersection","types":[{"type":"reference","name":"ViewProps"},{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","children":[{"name":"colors","kind":1024,"kindString":"Property","comment":{"shortText":"An array of colors that represent stops in the gradient. At least two colors are required\n(for a single-color background, use the `style.backgroundColor` prop on a `View` component)."},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"name":"end","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"shortText":"For example, `{ x: 0.1, y: 0.2 }` means that the gradient will end `10%` from the left and `20%` from the bottom.","text":"**On web**, this only changes the angle of the gradient because CSS gradients don't support changing the end position.\n"},"type":{"type":"union","types":[{"type":"reference","name":"LinearGradientPoint"},{"type":"literal","value":null}]}},{"name":"locations","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"shortText":"An array that contains `number`s ranging from `0` to `1`, inclusive, and is the same length as the `colors` property.\nEach number indicates a color-stop location where each respective color should be located.","text":"For example, `[0.5, 0.8]` would render:\n- the first color, solid, from the beginning of the gradient view to 50% through (the middle);\n- a gradient from the first color to the second from the 50% point to the 80% point; and\n- the second color, solid, from the 80% point to the end of the gradient view.\n\n> The color-stop locations must be ascending from least to greatest.\n"},"type":{"type":"union","types":[{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"literal","value":null}]}},{"name":"start","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"shortText":"For example, `{ x: 0.1, y: 0.2 }` means that the gradient will start `10%` from the left and `20%` from the top.","text":"**On web**, this only changes the angle of the gradient because CSS gradients don't support changing the starting position.\n"},"type":{"type":"union","types":[{"type":"reference","name":"LinearGradientPoint"},{"type":"literal","value":null}]}}]}}]}}]} \ No newline at end of file +{"name":"expo-linear-gradient","kind":1,"kindString":"Project","originalName":"","children":[{"name":"LinearGradient","kind":128,"kindString":"Class","comment":{"shortText":"Renders a native view that transitions between multiple colors in a linear direction."},"children":[{"name":"constructor","kind":512,"kindString":"Constructor","signatures":[{"name":"new LinearGradient","kind":16384,"kindString":"Constructor signature","parameters":[{"name":"props","kind":32768,"kindString":"Parameter","type":{"type":"union","types":[{"type":"reference","name":"LinearGradientProps"},{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}]}}],"type":{"type":"reference","name":"LinearGradient"},"inheritedFrom":{"type":"reference","name":"React.Component.constructor"}},{"name":"new LinearGradient","kind":16384,"kindString":"Constructor signature","comment":{"tags":[{"tag":"deprecated","text":""},{"tag":"see","text":"https://reactjs.org/docs/legacy-context.html\n"}]},"parameters":[{"name":"props","kind":32768,"kindString":"Parameter","type":{"type":"reference","name":"LinearGradientProps"}},{"name":"context","kind":32768,"kindString":"Parameter","type":{"type":"intrinsic","name":"any"}}],"type":{"type":"reference","name":"LinearGradient"},"inheritedFrom":{"type":"reference","name":"React.Component.constructor"}}],"inheritedFrom":{"type":"reference","name":"React.Component.constructor"}},{"name":"context","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"shortText":"If using the new style context, re-declare this in your class to be the\n`React.ContextType` of your `static contextType`.\nShould be used with type annotation or static contextType.","text":"```ts\nstatic contextType = MyContext\n// For TS pre-3.7:\ncontext!: React.ContextType\n// For TS 3.7 and above:\ndeclare context: React.ContextType\n```\n","tags":[{"tag":"see","text":"https://reactjs.org/docs/context.html\n"}]},"type":{"type":"intrinsic","name":"any"},"inheritedFrom":{"type":"reference","name":"React.Component.context"}},{"name":"props","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"type":{"type":"intersection","types":[{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"},{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","children":[{"name":"children","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"ReactNode"}}]}}],"name":"Readonly"}]},"inheritedFrom":{"type":"reference","name":"React.Component.props"}},{"name":"refs","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"tags":[{"tag":"deprecated","text":"\nhttps://reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs\n"}]},"type":{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","indexSignature":{"name":"__index","kind":8192,"kindString":"Index signature","parameters":[{"name":"key","kind":32768,"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"ReactInstance"}}}},"inheritedFrom":{"type":"reference","name":"React.Component.refs"}},{"name":"state","kind":1024,"kindString":"Property","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal"}}],"name":"Readonly"},"inheritedFrom":{"type":"reference","name":"React.Component.state"}},{"name":"contextType","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isOptional":true},"comment":{"shortText":"If set, `this.context` will be set at runtime to the current value of the given Context.","text":"Usage:\n\n```ts\ntype MyContext = number\nconst Ctx = React.createContext(0)\n\nclass Foo extends React.Component {\n static contextType = Ctx\n context!: React.ContextType\n render () {\n return <>My context's value: {this.context};\n }\n}\n```\n","tags":[{"tag":"see","text":"https://reactjs.org/docs/context.html#classcontexttype\n"}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"any"}],"name":"Context"},"inheritedFrom":{"type":"reference","name":"React.Component.contextType"}},{"name":"UNSAFE_componentWillMount","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"UNSAFE_componentWillMount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before mounting occurs, and before `Component#render`.\nAvoid introducing any side-effects or subscriptions in this method.","text":"This method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use componentDidMount or the constructor instead"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillMount"}}],"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillMount"}},{"name":"UNSAFE_componentWillReceiveProps","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"UNSAFE_componentWillReceiveProps","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called when the component may be receiving new props.\nReact may call this even if props have not changed, so be sure to compare new and existing\nprops if you only want to handle changes.","text":"Calling `Component#setState` generally does not trigger this method.\n\nThis method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use static getDerivedStateFromProps instead"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillReceiveProps"}}],"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillReceiveProps"}},{"name":"UNSAFE_componentWillUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"UNSAFE_componentWillUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before rendering when new props or state is received. Not called for the initial render.","text":"Note: You cannot call `Component#setState` here.\n\nThis method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use getSnapshotBeforeUpdate instead"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.UNSAFE_componentWillUpdate"}},{"name":"componentDidCatch","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentDidCatch","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Catches exceptions generated in descendant components. Unhandled exceptions will cause\nthe entire component tree to unmount."},"parameters":[{"name":"error","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error"}},{"name":"errorInfo","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"ErrorInfo"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentDidCatch"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentDidCatch"}},{"name":"componentDidMount","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentDidMount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately after a component is mounted. Setting state here will trigger re-rendering."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentDidMount"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentDidMount"}},{"name":"componentDidUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentDidUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately after updating occurs. Not called for the initial render.","text":"The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.\n"},"parameters":[{"name":"prevProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"prevState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"snapshot","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentDidUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentDidUpdate"}},{"name":"componentWillMount","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentWillMount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before mounting occurs, and before `Component#render`.\nAvoid introducing any side-effects or subscriptions in this method.","text":"Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use componentDidMount or the constructor instead; will stop working in React 17"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentWillMount"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentWillMount"}},{"name":"componentWillReceiveProps","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentWillReceiveProps","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called when the component may be receiving new props.\nReact may call this even if props have not changed, so be sure to compare new and existing\nprops if you only want to handle changes.","text":"Calling `Component#setState` generally does not trigger this method.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use static getDerivedStateFromProps instead; will stop working in React 17"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentWillReceiveProps"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentWillReceiveProps"}},{"name":"componentWillUnmount","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentWillUnmount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as\ncancelled network requests, or cleaning up any DOM elements created in `componentDidMount`."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentWillUnmount"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentWillUnmount"}},{"name":"componentWillUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"componentWillUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called immediately before rendering when new props or state is received. Not called for the initial render.","text":"Note: You cannot call `Component#setState` here.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n","tags":[{"tag":"deprecated","text":"16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update"},{"tag":"see","text":"https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path\n"}]},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.componentWillUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.componentWillUpdate"}},{"name":"forceUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true},"signatures":[{"name":"forceUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"name":"callback","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"signatures":[{"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.forceUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.forceUpdate"}},{"name":"getSnapshotBeforeUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"getSnapshotBeforeUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Runs before React applies the result of `render` to the document, and\nreturns an object to be given to componentDidUpdate. Useful for saving\nthings such as scroll position before `render` causes changes to it.","text":"Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated\nlifecycle events from running.\n"},"parameters":[{"name":"prevProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"prevState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}}],"type":{"type":"intrinsic","name":"any"},"inheritedFrom":{"type":"reference","name":"React.Component.getSnapshotBeforeUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.getSnapshotBeforeUpdate"}},{"name":"render","kind":2048,"kindString":"Method","signatures":[{"name":"render","kind":4096,"kindString":"Call signature","type":{"type":"reference","name":"Element"},"overwrites":{"type":"reference","name":"React.Component.render"}}],"overwrites":{"type":"reference","name":"React.Component.render"}},{"name":"setState","kind":2048,"kindString":"Method","flags":{"isExternal":true},"signatures":[{"name":"setState","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"typeParameter":[{"name":"K","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"never"}}],"parameters":[{"name":"state","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}},{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"signatures":[{"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"name":"prevState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"props","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}},{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}},{"type":"reference","name":"K"}],"name":"Pick"}]}}]}},{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}},{"type":"reference","name":"K"}],"name":"Pick"}]}},{"name":"callback","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"signatures":[{"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"React.Component.setState"}}],"inheritedFrom":{"type":"reference","name":"React.Component.setState"}},{"name":"shouldComponentUpdate","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"signatures":[{"name":"shouldComponentUpdate","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"shortText":"Called to determine whether the change in props and state should trigger a re-render.","text":"`Component` always returns true.\n`PureComponent` implements a shallow comparison on props and state and returns true if any\nprops or states have changed.\n\nIf false is returned, `Component#render`, `componentWillUpdate`\nand `componentDidUpdate` will not be called.\n"},"parameters":[{"name":"nextProps","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Readonly"}},{"name":"nextState","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}],"name":"Readonly"}},{"name":"nextContext","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"React.Component.shouldComponentUpdate"}}],"inheritedFrom":{"type":"reference","name":"React.Component.shouldComponentUpdate"}}],"extendedTypes":[{"type":"reference","typeArguments":[{"type":"reference","name":"LinearGradientProps"}],"name":"Component"}]},{"name":"LinearGradientPoint","kind":4194304,"kindString":"Type alias","comment":{"shortText":"An object `{ x: number; y: number }` or array `[x, y]` that represents the point\nat which the gradient starts or ends, as a fraction of the overall size of the gradient ranging\nfrom `0` to `1`, inclusive."},"type":{"type":"union","types":[{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","children":[{"name":"x","kind":1024,"kindString":"Property","comment":{"shortText":"A number ranging from `0` to `1`, representing the position of gradient transformation."},"type":{"type":"intrinsic","name":"number"}},{"name":"y","kind":1024,"kindString":"Property","comment":{"shortText":"A number ranging from `0` to `1`, representing the position of gradient transformation."},"type":{"type":"intrinsic","name":"number"}}]}},{"type":"reference","name":"NativeLinearGradientPoint"}]}},{"name":"LinearGradientProps","kind":4194304,"kindString":"Type alias","type":{"type":"intersection","types":[{"type":"reference","name":"ViewProps"},{"type":"reflection","declaration":{"name":"__type","kind":65536,"kindString":"Type literal","children":[{"name":"colors","kind":1024,"kindString":"Property","comment":{"shortText":"An array of colors that represent stops in the gradient. At least two colors are required\n(for a single-color background, use the `style.backgroundColor` prop on a `View` component)."},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"name":"end","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"shortText":"For example, `{ x: 0.1, y: 0.2 }` means that the gradient will end `10%` from the left and `20%` from the bottom.","text":"**On web**, this only changes the angle of the gradient because CSS gradients don't support changing the end position.","tags":[{"tag":"default","text":"{ x: 0.5, y: 1.0 }\n"}]},"type":{"type":"union","types":[{"type":"reference","name":"LinearGradientPoint"},{"type":"literal","value":null}]}},{"name":"locations","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"shortText":"An array that contains `number`s ranging from `0` to `1`, inclusive, and is the same length as the `colors` property.\nEach number indicates a color-stop location where each respective color should be located.","text":"For example, `[0.5, 0.8]` would render:\n- the first color, solid, from the beginning of the gradient view to 50% through (the middle);\n- a gradient from the first color to the second from the 50% point to the 80% point; and\n- the second color, solid, from the 80% point to the end of the gradient view.\n\n> The color-stop locations must be ascending from least to greatest.","tags":[{"tag":"default","text":"[0.0, 1.0]\n"}]},"type":{"type":"union","types":[{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"literal","value":null}]}},{"name":"start","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"shortText":"For example, `{ x: 0.1, y: 0.2 }` means that the gradient will start `10%` from the left and `20%` from the top.","text":"**On web**, this only changes the angle of the gradient because CSS gradients don't support changing the starting position.","tags":[{"tag":"default","text":"{ x: 0.5, y: 0.0 }\n"}]},"type":{"type":"union","types":[{"type":"reference","name":"LinearGradientPoint"},{"type":"literal","value":null}]}}]}}]}}]} \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index deaf51872b832b..995c304fd5ce07 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1909,8 +1909,6 @@ PODS: - EXJSONUtils/Tests (0.2.0) - EXKeepAwake (10.0.0): - ExpoModulesCore - - EXLinearGradient (10.0.1): - - ExpoModulesCore - EXLocalAuthentication (12.0.0): - ExpoModulesCore - EXLocalization (11.0.0): @@ -1939,6 +1937,8 @@ PODS: - ExpoModulesCore - ExpoHaptics (11.0.1): - ExpoModulesCore + - ExpoLinearGradient (10.0.1): + - ExpoModulesCore - ExpoModulesCore (0.4.2): - React-Core - ReactCommon/turbomodule/core @@ -2849,7 +2849,6 @@ DEPENDENCIES: - EXJSONUtils (from `../packages/expo-json-utils/ios`) - EXJSONUtils/Tests (from `../packages/expo-json-utils/ios`) - EXKeepAwake (from `../packages/expo-keep-awake/ios`) - - EXLinearGradient (from `../packages/expo-linear-gradient/ios`) - EXLocalAuthentication (from `../packages/expo-local-authentication/ios`) - EXLocalization (from `../packages/expo-localization/ios`) - EXLocation (from `../packages/expo-location/ios`) @@ -2863,6 +2862,7 @@ DEPENDENCIES: - Expo (from `../packages/expo/ios`) - ExpoCellular (from `../packages/expo-cellular/ios`) - ExpoHaptics (from `../packages/expo-haptics/ios`) + - ExpoLinearGradient (from `../packages/expo-linear-gradient/ios`) - ExpoModulesCore (from `../packages/expo-modules-core/ios`) - ExpoModulesCore/Tests (from `../packages/expo-modules-core/ios`) - ExpoSystemUI (from `../packages/expo-system-ui/ios`) @@ -3678,8 +3678,6 @@ EXTERNAL SOURCES: :path: "../packages/expo-json-utils/ios" EXKeepAwake: :path: "../packages/expo-keep-awake/ios" - EXLinearGradient: - :path: "../packages/expo-linear-gradient/ios" EXLocalAuthentication: :path: "../packages/expo-local-authentication/ios" EXLocalization: @@ -3704,6 +3702,8 @@ EXTERNAL SOURCES: :path: "../packages/expo-cellular/ios" ExpoHaptics: :path: "../packages/expo-haptics/ios" + ExpoLinearGradient: + :path: "../packages/expo-linear-gradient/ios" ExpoModulesCore: :path: "../packages/expo-modules-core/ios" ExpoSystemUI: @@ -4186,7 +4186,6 @@ SPEC CHECKSUMS: EXImagePicker: cecd37aa68c3df69fc0599cae92523be84fe6a1d EXJSONUtils: f515cf71710855d7ba5bfc6752af3b9a6f6aad01 EXKeepAwake: 8aa32396a5972d26e75e538603aad0f032396503 - EXLinearGradient: cac7d90c8b8112736a7630cbd7d9dc242e7b075b EXLocalAuthentication: 4c640e20a308d66224468661a0da434f86435283 EXLocalization: bb38414618b30a177482c9a6f5594ec6eb0898c1 EXLocation: 6d13fb1d4b65ed1b2d2bdd0b0f11417cc0a2656a @@ -4199,6 +4198,7 @@ SPEC CHECKSUMS: Expo: 23ed30f225511b93fa6a0c14d9a3208d6b749060 ExpoCellular: 90940614d45df5b31f281d70a63d92a06fe44af4 ExpoHaptics: c0c014eabfdd1353a908f857f168b01fafd526db + ExpoLinearGradient: 841746b0ef9c771d1f37fa5463f39eb25b6aae77 ExpoModulesCore: daacb24b99b77ec28c0cbc877a574b1f8e6709c9 ExpoSystemUI: 3c969e3db290fcd5edb9c466d585f183d934b421 EXPrint: a224501bbb89072567c58a5127f2d125b8776ea2 diff --git a/packages/expo-linear-gradient/CHANGELOG.md b/packages/expo-linear-gradient/CHANGELOG.md index 2539bf8ddf9c03..6aabdc14c6918f 100644 --- a/packages/expo-linear-gradient/CHANGELOG.md +++ b/packages/expo-linear-gradient/CHANGELOG.md @@ -10,6 +10,8 @@ ### 💡 Others +- Rewrote code to Swift, removed legacy Objective-C module implementation and changed the pod name to `ExpoLinearGradient`. ([#15168](https://github.com/expo/expo/pull/15168) by [@tsapeta](https://github.com/tsapeta)) + ## 10.0.1 — 2021-10-01 _This version does not introduce any user-facing changes._ diff --git a/packages/expo-linear-gradient/build/LinearGradient.d.ts b/packages/expo-linear-gradient/build/LinearGradient.d.ts index 2df35602ba7971..fa0b6e078df07c 100644 --- a/packages/expo-linear-gradient/build/LinearGradient.d.ts +++ b/packages/expo-linear-gradient/build/LinearGradient.d.ts @@ -32,18 +32,21 @@ export declare type LinearGradientProps = ViewProps & { * - the second color, solid, from the 80% point to the end of the gradient view. * * > The color-stop locations must be ascending from least to greatest. + * @default [0.0, 1.0] */ locations?: number[] | null; /** * For example, `{ x: 0.1, y: 0.2 }` means that the gradient will start `10%` from the left and `20%` from the top. * * **On web**, this only changes the angle of the gradient because CSS gradients don't support changing the starting position. + * @default { x: 0.5, y: 0.0 } */ start?: LinearGradientPoint | null; /** * For example, `{ x: 0.1, y: 0.2 }` means that the gradient will end `10%` from the left and `20%` from the bottom. * * **On web**, this only changes the angle of the gradient because CSS gradients don't support changing the end position. + * @default { x: 0.5, y: 1.0 } */ end?: LinearGradientPoint | null; }; diff --git a/packages/expo-linear-gradient/build/LinearGradient.js.map b/packages/expo-linear-gradient/build/LinearGradient.js.map index 60c2bca4c2f3e5..3c613086644a29 100644 --- a/packages/expo-linear-gradient/build/LinearGradient.js.map +++ b/packages/expo-linear-gradient/build/LinearGradient.js.map @@ -1 +1 @@ -{"version":3,"file":"LinearGradient.js","sourceRoot":"","sources":["../src/LinearGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAa,MAAM,cAAc,CAAC;AAEjE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAuD1D;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK,CAAC,SAA8B;IACtE,MAAM;QACJ,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC/D,IAAI,iBAAiB,GAAG,SAAS,CAAC;QAClC,IAAI,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE;YACnD,OAAO,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;YAC9F,iBAAiB,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;SACvD;QAED,OAAO,CACL,oBAAC,oBAAoB,OACf,KAAK,EACT,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACtB,GAAG,EAAE,MAAa;gBAClB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;aAClC,CAAC,EACF,SAAS,EAAE,iBAAiB,EAC5B,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,GAAG,CAAC,GAC9B,CACH,CAAC;IACJ,CAAC;CACF;AAED,SAAS,eAAe,CACtB,KAA6C;IAE7C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9C,OAAO,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;QAC7F,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import * as React from 'react';\nimport { Platform, processColor, ViewProps } from 'react-native';\n\nimport NativeLinearGradient from './NativeLinearGradient';\nimport { NativeLinearGradientPoint } from './NativeLinearGradient.types';\n\n// @needsAudit\n/**\n * An object `{ x: number; y: number }` or array `[x, y]` that represents the point\n * at which the gradient starts or ends, as a fraction of the overall size of the gradient ranging\n * from `0` to `1`, inclusive.\n */\nexport type LinearGradientPoint =\n | {\n /**\n * A number ranging from `0` to `1`, representing the position of gradient transformation.\n */\n x: number;\n /**\n * A number ranging from `0` to `1`, representing the position of gradient transformation.\n */\n y: number;\n }\n | NativeLinearGradientPoint;\n\n// @needsAudit\nexport type LinearGradientProps = ViewProps & {\n /**\n * An array of colors that represent stops in the gradient. At least two colors are required\n * (for a single-color background, use the `style.backgroundColor` prop on a `View` component).\n */\n colors: string[];\n /**\n * An array that contains `number`s ranging from `0` to `1`, inclusive, and is the same length as the `colors` property.\n * Each number indicates a color-stop location where each respective color should be located.\n *\n * For example, `[0.5, 0.8]` would render:\n * - the first color, solid, from the beginning of the gradient view to 50% through (the middle);\n * - a gradient from the first color to the second from the 50% point to the 80% point; and\n * - the second color, solid, from the 80% point to the end of the gradient view.\n *\n * > The color-stop locations must be ascending from least to greatest.\n */\n locations?: number[] | null;\n /**\n * For example, `{ x: 0.1, y: 0.2 }` means that the gradient will start `10%` from the left and `20%` from the top.\n *\n * **On web**, this only changes the angle of the gradient because CSS gradients don't support changing the starting position.\n */\n start?: LinearGradientPoint | null;\n /**\n * For example, `{ x: 0.1, y: 0.2 }` means that the gradient will end `10%` from the left and `20%` from the bottom.\n *\n * **On web**, this only changes the angle of the gradient because CSS gradients don't support changing the end position.\n */\n end?: LinearGradientPoint | null;\n};\n\n/**\n * Renders a native view that transitions between multiple colors in a linear direction.\n */\nexport class LinearGradient extends React.Component {\n render() {\n const { colors, locations, start, end, ...props } = this.props;\n let resolvedLocations = locations;\n if (locations && colors.length !== locations.length) {\n console.warn('LinearGradient colors and locations props should be arrays of the same length');\n resolvedLocations = locations.slice(0, colors.length);\n }\n\n return (\n \n );\n }\n}\n\nfunction _normalizePoint(\n point: LinearGradientPoint | null | undefined\n): NativeLinearGradientPoint | undefined {\n if (!point) {\n return undefined;\n }\n\n if (Array.isArray(point) && point.length !== 2) {\n console.warn('start and end props for LinearGradient must be of the format [x,y] or {x, y}');\n return undefined;\n }\n\n return Array.isArray(point) ? point : [point.x, point.y];\n}\n"]} \ No newline at end of file +{"version":3,"file":"LinearGradient.js","sourceRoot":"","sources":["../src/LinearGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAa,MAAM,cAAc,CAAC;AAEjE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AA0D1D;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK,CAAC,SAA8B;IACtE,MAAM;QACJ,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC/D,IAAI,iBAAiB,GAAG,SAAS,CAAC;QAClC,IAAI,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE;YACnD,OAAO,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;YAC9F,iBAAiB,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;SACvD;QAED,OAAO,CACL,oBAAC,oBAAoB,OACf,KAAK,EACT,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACtB,GAAG,EAAE,MAAa;gBAClB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;aAClC,CAAC,EACF,SAAS,EAAE,iBAAiB,EAC5B,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,GAAG,CAAC,GAC9B,CACH,CAAC;IACJ,CAAC;CACF;AAED,SAAS,eAAe,CACtB,KAA6C;IAE7C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9C,OAAO,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;QAC7F,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import * as React from 'react';\nimport { Platform, processColor, ViewProps } from 'react-native';\n\nimport NativeLinearGradient from './NativeLinearGradient';\nimport { NativeLinearGradientPoint } from './NativeLinearGradient.types';\n\n// @needsAudit\n/**\n * An object `{ x: number; y: number }` or array `[x, y]` that represents the point\n * at which the gradient starts or ends, as a fraction of the overall size of the gradient ranging\n * from `0` to `1`, inclusive.\n */\nexport type LinearGradientPoint =\n | {\n /**\n * A number ranging from `0` to `1`, representing the position of gradient transformation.\n */\n x: number;\n /**\n * A number ranging from `0` to `1`, representing the position of gradient transformation.\n */\n y: number;\n }\n | NativeLinearGradientPoint;\n\n// @needsAudit\nexport type LinearGradientProps = ViewProps & {\n /**\n * An array of colors that represent stops in the gradient. At least two colors are required\n * (for a single-color background, use the `style.backgroundColor` prop on a `View` component).\n */\n colors: string[];\n /**\n * An array that contains `number`s ranging from `0` to `1`, inclusive, and is the same length as the `colors` property.\n * Each number indicates a color-stop location where each respective color should be located.\n *\n * For example, `[0.5, 0.8]` would render:\n * - the first color, solid, from the beginning of the gradient view to 50% through (the middle);\n * - a gradient from the first color to the second from the 50% point to the 80% point; and\n * - the second color, solid, from the 80% point to the end of the gradient view.\n *\n * > The color-stop locations must be ascending from least to greatest.\n * @default [0.0, 1.0]\n */\n locations?: number[] | null;\n /**\n * For example, `{ x: 0.1, y: 0.2 }` means that the gradient will start `10%` from the left and `20%` from the top.\n *\n * **On web**, this only changes the angle of the gradient because CSS gradients don't support changing the starting position.\n * @default { x: 0.5, y: 0.0 }\n */\n start?: LinearGradientPoint | null;\n /**\n * For example, `{ x: 0.1, y: 0.2 }` means that the gradient will end `10%` from the left and `20%` from the bottom.\n *\n * **On web**, this only changes the angle of the gradient because CSS gradients don't support changing the end position.\n * @default { x: 0.5, y: 1.0 }\n */\n end?: LinearGradientPoint | null;\n};\n\n/**\n * Renders a native view that transitions between multiple colors in a linear direction.\n */\nexport class LinearGradient extends React.Component {\n render() {\n const { colors, locations, start, end, ...props } = this.props;\n let resolvedLocations = locations;\n if (locations && colors.length !== locations.length) {\n console.warn('LinearGradient colors and locations props should be arrays of the same length');\n resolvedLocations = locations.slice(0, colors.length);\n }\n\n return (\n \n );\n }\n}\n\nfunction _normalizePoint(\n point: LinearGradientPoint | null | undefined\n): NativeLinearGradientPoint | undefined {\n if (!point) {\n return undefined;\n }\n\n if (Array.isArray(point) && point.length !== 2) {\n console.warn('start and end props for LinearGradient must be of the format [x,y] or {x, y}');\n return undefined;\n }\n\n return Array.isArray(point) ? point : [point.x, point.y];\n}\n"]} \ No newline at end of file diff --git a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradient.h b/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradient.h deleted file mode 100644 index da202fc1c2bf87..00000000000000 --- a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradient.h +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -@interface EXLinearGradient : UIView - -- (void)setColors:(NSArray *)colorStrings; -- (void)setLocations:(NSArray *)locations; -- (void)setStartPoint:(CGPoint)start; -- (void)setEndPoint:(CGPoint)end; - -@end diff --git a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradient.m b/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradient.m deleted file mode 100644 index 56b64112612859..00000000000000 --- a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradient.m +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import -#import -#import -#import -#import - -@interface EXLinearGradient () - -@end - -@implementation EXLinearGradient - -+ (Class)layerClass -{ - return [EXLinearGradientLayer class]; -} - -- (EXLinearGradientLayer *)gradientLayer -{ - return (EXLinearGradientLayer *)self.layer; -} - -- (void)setColors:(NSArray *)colorStrings -{ - NSMutableArray *colors = [NSMutableArray arrayWithCapacity:colorStrings.count]; - for (NSString *colorString in colorStrings) { - UIColor *convertedColor = [EXUtilities UIColor:colorString]; - if (convertedColor) { - [colors addObject:convertedColor]; - } - } - self.gradientLayer.colors = colors; -} - -- (void)setStartPoint:(CGPoint)start -{ - self.gradientLayer.startPoint = start; -} - -- (void)setEndPoint:(CGPoint)end -{ - self.gradientLayer.endPoint = end; -} - -- (void)setLocations:(NSArray *)locations -{ - self.gradientLayer.locations = locations; -} - -@end diff --git a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientLayer.h b/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientLayer.h deleted file mode 100644 index 56b66d2bebd01e..00000000000000 --- a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientLayer.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import -#import -#import - -@interface EXLinearGradientLayer : CALayer - -@property (nullable, nonatomic, copy) NSArray *colors; -@property (nullable, nonatomic, copy) NSArray *locations; -@property (nonatomic) CGPoint startPoint; -@property (nonatomic) CGPoint endPoint; - -@end diff --git a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientLayer.m b/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientLayer.m deleted file mode 100644 index 5151a5fea21214..00000000000000 --- a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientLayer.m +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import - -@implementation EXLinearGradientLayer - -- (instancetype)init -{ - self = [super init]; - - if (self) { - self.needsDisplayOnBoundsChange = YES; - self.masksToBounds = YES; - _startPoint = CGPointMake(0.5, 0.0); - _endPoint = CGPointMake(0.5, 1.0); - } - - return self; -} - -- (void)setColors:(NSArray *)colors -{ - _colors = colors; - [self setNeedsDisplay]; -} - -- (void)setLocations:(NSArray *)locations -{ - _locations = locations; - [self setNeedsDisplay]; -} - -- (void)setStartPoint:(CGPoint)startPoint -{ - _startPoint = startPoint; - [self setNeedsDisplay]; -} - -- (void)setEndPoint:(CGPoint)endPoint -{ - _endPoint = endPoint; - [self setNeedsDisplay]; -} - -- (void)display { - [super display]; - - BOOL hasAlpha = NO; - - for (NSInteger i = 0; i < self.colors.count; i++) { - hasAlpha = hasAlpha || CGColorGetAlpha(self.colors[i].CGColor) < 1.0; - } - - UIGraphicsBeginImageContextWithOptions(self.bounds.size, !hasAlpha, 0.0); - CGContextRef ref = UIGraphicsGetCurrentContext(); - [self drawInContext:ref]; - - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - self.contents = (__bridge id _Nullable)(image.CGImage); - self.contentsScale = image.scale; - - UIGraphicsEndImageContext(); -} - -- (void)drawInContext:(CGContextRef)ctx -{ - [super drawInContext:ctx]; - - CGContextSaveGState(ctx); - - CGSize size = self.bounds.size; - if (!self.colors || self.colors.count == 0 || size.width == 0.0 || size.height == 0.0) - return; - - - CGFloat *locations = nil; - - locations = malloc(sizeof(CGFloat) * self.colors.count); - - for (NSInteger i = 0; i < self.colors.count; i++) { - if (self.locations.count > i) { - locations[i] = self.locations[i].floatValue; - } else { - locations[i] = (1.0 / (self.colors.count - 1)) * i; - } - } - - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - NSMutableArray *colors = [[NSMutableArray alloc] initWithCapacity:self.colors.count]; - for (UIColor *color in self.colors) { - [colors addObject:(id)color.CGColor]; - } - - CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)colors, locations); - - free(locations); - - CGPoint start = self.startPoint, end = self.endPoint; - - CGContextDrawLinearGradient(ctx, gradient, - CGPointMake(start.x * size.width, start.y * size.height), - CGPointMake(end.x * size.width, end.y * size.height), - kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation); - CGGradientRelease(gradient); - CGColorSpaceRelease(colorSpace); - - CGContextRestoreGState(ctx); -} - -@end diff --git a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientManager.h b/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientManager.h deleted file mode 100644 index d1ea5bd59530ac..00000000000000 --- a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientManager.h +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import - -@interface EXLinearGradientManager : EXViewManager - -@end diff --git a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientManager.m b/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientManager.m deleted file mode 100644 index b6596590b2eae0..00000000000000 --- a/packages/expo-linear-gradient/ios/EXLinearGradient/EXLinearGradientManager.m +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import -#import - -@interface EXLinearGradientManager () - -@end - -@implementation EXLinearGradientManager - -EX_EXPORT_MODULE(ExpoLinearGradientManager); - -- (NSString *)viewName -{ - return @"ExpoLinearGradient"; -} - -- (UIView *)view -{ - return [[EXLinearGradient alloc] init]; -} - -EX_VIEW_PROPERTY(colors, NSArray *, EXLinearGradient) { - [view setColors:value]; -} - -// NOTE: startPoint and endPoint assume that the value is an array with exactly two floats - -EX_VIEW_PROPERTY(startPoint, NSArray *, EXLinearGradient) { - CGPoint point = CGPointMake([[value objectAtIndex:0] floatValue], [[value objectAtIndex:1] floatValue]); - [view setStartPoint:point]; -} - -EX_VIEW_PROPERTY(endPoint, NSArray *, EXLinearGradient) { - CGPoint point = CGPointMake([[value objectAtIndex:0] floatValue], [[value objectAtIndex:1] floatValue]); - [view setEndPoint:point]; -} - -EX_VIEW_PROPERTY(locations, NSArray *, EXLinearGradient) { - [view setLocations:value]; -} - -@end diff --git a/packages/expo-linear-gradient/ios/EXLinearGradient/LinearGradientModule.swift b/packages/expo-linear-gradient/ios/EXLinearGradient/LinearGradientModule.swift deleted file mode 100644 index d16869fea8c9ce..00000000000000 --- a/packages/expo-linear-gradient/ios/EXLinearGradient/LinearGradientModule.swift +++ /dev/null @@ -1,29 +0,0 @@ -import ExpoModulesCore - -public class LinearGradientModule: Module { - public func definition() -> ModuleDefinition { - name("ExpoLinearGradient") - - viewManager { - view { - EXLinearGradient() - } - - prop("colors") { (view: EXLinearGradient, colors: [Int]) in - view.setColors(colors) - } - - prop("startPoint") { (view: EXLinearGradient, startPoint: [Double]) in - view.setStart(CGPoint(x: startPoint[0], y: startPoint[1])) - } - - prop("endPoint") { (view: EXLinearGradient, endPoint: [Double]) in - view.setEnd(CGPoint(x: endPoint[0], y: endPoint[1])) - } - - prop("locations") { (view: EXLinearGradient, locations: [Double]) in - view.setLocations(locations) - } - } - } -} diff --git a/packages/expo-linear-gradient/ios/EXLinearGradient.podspec b/packages/expo-linear-gradient/ios/ExpoLinearGradient.podspec similarity index 87% rename from packages/expo-linear-gradient/ios/EXLinearGradient.podspec rename to packages/expo-linear-gradient/ios/ExpoLinearGradient.podspec index 7c90629d65eb3a..74e47d4ecc6a14 100644 --- a/packages/expo-linear-gradient/ios/EXLinearGradient.podspec +++ b/packages/expo-linear-gradient/ios/ExpoLinearGradient.podspec @@ -3,7 +3,7 @@ require 'json' package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json'))) Pod::Spec.new do |s| - s.name = 'EXLinearGradient' + s.name = 'ExpoLinearGradient' s.version = package['version'] s.summary = package['description'] s.description = package['description'] @@ -24,9 +24,9 @@ Pod::Spec.new do |s| } if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0') - s.source_files = "#{s.name}/**/*.h" + s.source_files = "**/*.h" s.vendored_frameworks = "#{s.name}.xcframework" else - s.source_files = "#{s.name}/**/*.{h,m,swift}" + s.source_files = "**/*.{h,m,swift}" end end diff --git a/packages/expo-linear-gradient/ios/LinearGradientLayer.swift b/packages/expo-linear-gradient/ios/LinearGradientLayer.swift new file mode 100644 index 00000000000000..168a9d62d640e9 --- /dev/null +++ b/packages/expo-linear-gradient/ios/LinearGradientLayer.swift @@ -0,0 +1,101 @@ +// Copyright 2021-present 650 Industries. All rights reserved. + +import QuartzCore +import CoreGraphics + +var defaultStartPoint = CGPoint(x: 0.5, y: 0.0) +var defaultEndPoint = CGPoint(x: 0.5, y: 1.0) +var defaultLocations: [CGFloat] = [0.0, 1.0] + +final class LinearGradientLayer: CALayer { + var colors = [CGColor]() + var startPoint = defaultStartPoint + var endPoint = defaultEndPoint + var locations = defaultLocations + + override init() { + super.init() + self.needsDisplayOnBoundsChange = true + self.masksToBounds = true + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func setColors(_ colors: [CGColor]) { + self.colors = colors + setNeedsDisplay() + } + + func setStartPoint(_ startPoint: CGPoint?) { + self.startPoint = startPoint ?? defaultStartPoint + setNeedsDisplay() + } + + func setEndPoint(_ endPoint: CGPoint?) { + self.endPoint = endPoint ?? defaultEndPoint + setNeedsDisplay() + } + + func setLocations(_ locations: [CGFloat]?) { + self.locations = locations ?? defaultLocations + setNeedsDisplay() + } + + override func display() { + super.display() + + if colors.isEmpty || bounds.size.width.isZero || bounds.size.height.isZero { + return + } + let hasAlpha = colors.reduce(false) { result, color in + return result || color.alpha < 1.0 + } + + UIGraphicsBeginImageContextWithOptions(bounds.size, !hasAlpha, 0.0) + + guard let contextRef = UIGraphicsGetCurrentContext() else { + return + } + + draw(in: contextRef) + + guard let image = UIGraphicsGetImageFromCurrentImageContext() else { + return + } + + self.contents = image.cgImage + self.contentsScale = image.scale + + UIGraphicsEndImageContext() + } + + override func draw(in ctx: CGContext) { + super.draw(in: ctx) + + ctx.saveGState() + + let colorSpace = CGColorSpaceCreateDeviceRGB() + let locations = colors.enumerated().map { (offset: Int, element: CGColor) -> CGFloat in + if self.locations.count > offset { + return self.locations[offset] + } else { + return CGFloat(offset) / CGFloat(colors.count - 1) + } + } + + if let gradient = CGGradient(colorsSpace: colorSpace, colors: colors as CFArray, locations: locations) { + let size = bounds.size + + ctx.drawLinearGradient( + gradient, + start: CGPoint(x: startPoint.x * size.width, y: startPoint.y * size.height), + end: CGPoint(x: endPoint.x * size.width, y: endPoint.y * size.height), + options: [.drawsBeforeStartLocation, .drawsAfterEndLocation] + ) + } + + ctx.restoreGState() + } +} diff --git a/packages/expo-linear-gradient/ios/LinearGradientModule.swift b/packages/expo-linear-gradient/ios/LinearGradientModule.swift new file mode 100644 index 00000000000000..1b70cfc0075fd7 --- /dev/null +++ b/packages/expo-linear-gradient/ios/LinearGradientModule.swift @@ -0,0 +1,32 @@ +// Copyright 2021-present 650 Industries. All rights reserved. + +import CoreGraphics +import ExpoModulesCore + +public class LinearGradientModule: Module { + public func definition() -> ModuleDefinition { + name("ExpoLinearGradient") + + viewManager { + view { + LinearGradientView() + } + + prop("colors") { (view: LinearGradientView, colors: [CGColor]) in + view.gradientLayer.setColors(colors) + } + + prop("startPoint") { (view: LinearGradientView, startPoint: CGPoint?) in + view.gradientLayer.setStartPoint(startPoint) + } + + prop("endPoint") { (view: LinearGradientView, endPoint: CGPoint?) in + view.gradientLayer.setEndPoint(endPoint) + } + + prop("locations") { (view: LinearGradientView, locations: [CGFloat]?) in + view.gradientLayer.setLocations(locations) + } + } + } +} diff --git a/packages/expo-linear-gradient/ios/LinearGradientView.swift b/packages/expo-linear-gradient/ios/LinearGradientView.swift new file mode 100644 index 00000000000000..527a467f327e59 --- /dev/null +++ b/packages/expo-linear-gradient/ios/LinearGradientView.swift @@ -0,0 +1,13 @@ +// Copyright 2021-present 650 Industries. All rights reserved. + +import UIKit + +final class LinearGradientView: UIView { + override class var layerClass: AnyClass { + return LinearGradientLayer.self + } + + public var gradientLayer: LinearGradientLayer { + return layer as! LinearGradientLayer + } +} diff --git a/packages/expo-linear-gradient/src/LinearGradient.tsx b/packages/expo-linear-gradient/src/LinearGradient.tsx index e49970998794f1..89f340bc9a62e3 100644 --- a/packages/expo-linear-gradient/src/LinearGradient.tsx +++ b/packages/expo-linear-gradient/src/LinearGradient.tsx @@ -40,18 +40,21 @@ export type LinearGradientProps = ViewProps & { * - the second color, solid, from the 80% point to the end of the gradient view. * * > The color-stop locations must be ascending from least to greatest. + * @default [0.0, 1.0] */ locations?: number[] | null; /** * For example, `{ x: 0.1, y: 0.2 }` means that the gradient will start `10%` from the left and `20%` from the top. * * **On web**, this only changes the angle of the gradient because CSS gradients don't support changing the starting position. + * @default { x: 0.5, y: 0.0 } */ start?: LinearGradientPoint | null; /** * For example, `{ x: 0.1, y: 0.2 }` means that the gradient will end `10%` from the left and `20%` from the bottom. * * **On web**, this only changes the angle of the gradient because CSS gradients don't support changing the end position. + * @default { x: 0.5, y: 1.0 } */ end?: LinearGradientPoint | null; }; diff --git a/packages/expo-linear-gradient/unimodule.json b/packages/expo-linear-gradient/unimodule.json deleted file mode 100644 index 73a34ced266460..00000000000000 --- a/packages/expo-linear-gradient/unimodule.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "expo-linear-gradient", - "platforms": ["ios", "android"] -} diff --git a/packages/expo-modules-core/ios/Swift/Conversions.swift b/packages/expo-modules-core/ios/Swift/Conversions.swift index 4c1bd19aa1d2e8..2d3365f370b48c 100644 --- a/packages/expo-modules-core/ios/Swift/Conversions.swift +++ b/packages/expo-modules-core/ios/Swift/Conversions.swift @@ -39,6 +39,8 @@ internal final class Conversions { case let object as NSDictionary: let keyValuePairs: [(String, Any)] = object.map { ($0 as! String, Conversions.fromNSObject($1)) } return Dictionary(uniqueKeysWithValues: keyValuePairs) + case is NSNull: + return Optional.none as Any default: return object }