@leonsilicon/react-native-wishlist 0.0.0 → 0.0.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/README.md CHANGED
@@ -149,7 +149,10 @@ To build the same cell in WishList, you would write the following:
149
149
 
150
150
  ```jsx
151
151
  function TextMessageCell() {
152
- const username = useTemplateValue<TextChatMessage>(message => message.sender.username)
152
+ const username = useTemplateValue<TextChatMessage>(message => {
153
+ 'worklet';
154
+ return message.sender.username;
155
+ })
153
156
 
154
157
  return (
155
158
  <View style={styles.cell}>
@@ -161,7 +164,7 @@ function TextMessageCell() {
161
164
  }
162
165
  ```
163
166
 
164
- In this case, `username` is a Proxy that holds the JSI HostObject, which is synchronized across threads.
167
+ In this case, `username` is a Proxy that holds the JSI HostObject, which is synchronized across threads. Pass a mapper that begins with `'worklet';` (and register `useTemplateValue` with `react-native-worklets-core/plugin` via `functionsToWorkletize`) so the mapper is compiled for the UI-thread runtime; nested function literals invoked from that mapper need their own `'worklet';` as well.
165
168
 
166
169
  We need to use `<WishList.Text>` instead of `<Text>` so that the update pipeline is able to imperatively update it's content on the UI Thread.
167
170
 
@@ -196,7 +199,10 @@ Wheras in **WishList** you'd have to use a template-value so it can update on th
196
199
 
197
200
  ```jsx
198
201
  function TextMessageCell() {
199
- const isSender = useTemplateValue<TextChatMessage>(message => message.isSender)
202
+ const isSender = useTemplateValue<TextChatMessage>(message => {
203
+ 'worklet';
204
+ return message.isSender;
205
+ })
200
206
 
201
207
  return (
202
208
  <View style={styles.cell}>
@@ -8,28 +8,24 @@
8
8
  namespace facebook {
9
9
  namespace react {
10
10
 
11
- class MGContentContainerComponentDescriptor
12
- : public ConcreteComponentDescriptor<MGContentContainerShadowNode> {
11
+ class MGContentContainerComponentDescriptor : public ConcreteComponentDescriptor<MGContentContainerShadowNode> {
13
12
  using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
14
13
 
15
- std::shared_ptr<ShadowNode> cloneShadowNode(
16
- const ShadowNode &sourceShadowNode,
17
- const ShadowNodeFragment &fragment) const override {
14
+ std::shared_ptr<ShadowNode> cloneShadowNode(const ShadowNode &sourceShadowNode, const ShadowNodeFragment &fragment)
15
+ const override
16
+ {
18
17
  // React holds on to old shadow nodes so we need to make sure to get the
19
18
  // latest state when cloning those to get the children that were set by
20
19
  // Wishlist.
21
- auto &mostRecentStateData = static_cast<ConcreteState const *>(
22
- sourceShadowNode.getMostRecentState().get())
23
- ->getData();
20
+ auto &mostRecentStateData =
21
+ static_cast<ConcreteState const *>(sourceShadowNode.getMostRecentState().get())->getData();
24
22
  auto wishlistChildren = mostRecentStateData.wishlistChildren;
25
- auto children =
26
- wishlistChildren
27
- ? std::make_shared<std::vector<std::shared_ptr<const ShadowNode>>>(
28
- *wishlistChildren)
29
- : fragment.children;
23
+ auto children = fragment.children
24
+ ? fragment.children
25
+ : (wishlistChildren ? std::make_shared<std::vector<std::shared_ptr<const ShadowNode>>>(*wishlistChildren)
26
+ : fragment.children);
30
27
  auto shadowNode = std::make_shared<MGContentContainerShadowNode>(
31
- sourceShadowNode,
32
- ShadowNodeFragment{fragment.props, children, fragment.state});
28
+ sourceShadowNode, ShadowNodeFragment{fragment.props, children, fragment.state});
33
29
 
34
30
  adopt(*shadowNode);
35
31
  return shadowNode;
@@ -23,7 +23,6 @@ void ComponentsPool::returnToPool(std::shared_ptr<ShadowNode const> sn) {
23
23
  if (sn == nullptr) {
24
24
  return;
25
25
  }
26
- ShadowNodeCopyMachine::clearParent(sn);
27
26
  std::string type = tagToType_[sn->getTag()];
28
27
  reusable_[type].push_back(sn);
29
28
  }
@@ -39,7 +38,9 @@ std::shared_ptr<ShadowNode const> ComponentsPool::getNodeForType(const std::stri
39
38
  if (reusable_[type].size() > 0) {
40
39
  auto res = reusable_[type].back();
41
40
  reusable_[type].pop_back();
42
- return res;
41
+ auto deepCopy = ShadowNodeCopyMachine::copyShadowSubtree(res);
42
+ tagToType_[deepCopy->getTag()] = type;
43
+ return deepCopy;
43
44
  }
44
45
 
45
46
  auto templateNode = registeredViews_[nameToIndex_[type]];
@@ -188,8 +188,9 @@ Value ShadowNodeBinding::get(Runtime &rt, const PropNameID &nameProp) {
188
188
  subItems.getValueAtIndex(rt, i)
189
189
  .getObject(rt)
190
190
  .getHostObject<ShadowNodeBinding>(rt);
191
- ShadowNodeCopyMachine::clearParent(child->sn_);
192
- newChildren->push_back(child->sn_);
191
+ auto clonedChild = ShadowNodeCopyMachine::copyShadowSubtree(child->sn_);
192
+ newChildren->push_back(clonedChild);
193
+ child->sn_ = clonedChild;
193
194
  child->parent_ = shared_from_this();
194
195
  }
195
196
 
@@ -3,48 +3,6 @@
3
3
  #include "WishlistJsRuntime.h"
4
4
 
5
5
  namespace Wishlist {
6
- namespace {
7
-
8
- // dirty hack don't do it at home
9
- //
10
- // NOTE: This mirrors the private layout of `facebook::react::ShadowNodeFamily`
11
- // for React Native 0.83. We only use it via `reinterpret_cast` to reach the
12
- // private `parent_`/`hasParent_` slots. RN 0.83 made `ShadowNodeFamily` derive
13
- // from `jsi::NativeState` and moved `nativeProps_DEPRECATED` to a public field
14
- // at the top of the class, so the order below differs from older versions of
15
- // the library.
16
- class ShadowNodeFamilyHack final : public jsi::NativeState {
17
- public:
18
- using Shared = std::shared_ptr<ShadowNodeFamily const>;
19
- using Weak = std::weak_ptr<ShadowNodeFamily const>;
20
-
21
- ShadowNodeFamilyHack() = delete;
22
-
23
- mutable std::unique_ptr<folly::dynamic> nativeProps_DEPRECATED;
24
-
25
- private:
26
- [[maybe_unused]] EventDispatcher::Weak eventDispatcher_;
27
- [[maybe_unused]] mutable std::shared_ptr<State const> mostRecentState_;
28
- [[maybe_unused]] mutable std::shared_mutex mutex_;
29
- [[maybe_unused]] mutable std::function<void(ShadowNodeFamily &family)>
30
- onUnmountedFamilyDestroyedCallback_;
31
- [[maybe_unused]] Tag const tag_;
32
- [[maybe_unused]] SurfaceId const surfaceId_;
33
- [[maybe_unused]] mutable InstanceHandle::Shared instanceHandle_;
34
- [[maybe_unused]] SharedEventEmitter const eventEmitter_;
35
- [[maybe_unused]] ComponentDescriptor const &componentDescriptor_;
36
- [[maybe_unused]] ComponentHandle componentHandle_;
37
- [[maybe_unused]] ComponentName componentName_;
38
-
39
- public:
40
- mutable ShadowNodeFamily::Weak parent_{};
41
- mutable bool hasParent_{false};
42
-
43
- private:
44
- [[maybe_unused]] mutable bool hasBeenMounted_{false};
45
- };
46
-
47
- } // namespace
48
6
 
49
7
  int tag = -2;
50
8
 
@@ -84,12 +42,4 @@ std::shared_ptr<ShadowNode> ShadowNodeCopyMachine::copyShadowSubtree(
84
42
  return shadowNode;
85
43
  }
86
44
 
87
- void ShadowNodeCopyMachine::clearParent(
88
- const std::shared_ptr<const ShadowNode> &sn) {
89
- auto *family =
90
- reinterpret_cast<const ShadowNodeFamilyHack *>(&sn->getFamily());
91
- family->hasParent_ = false;
92
- family->parent_.reset();
93
- }
94
-
95
45
  }; // namespace Wishlist
@@ -19,7 +19,6 @@ class ShadowNodeCopyMachine {
19
19
  public:
20
20
  static std::shared_ptr<ShadowNode> copyShadowSubtree(
21
21
  const std::shared_ptr<const ShadowNode> &sn);
22
- static void clearParent(const std::shared_ptr<const ShadowNode> &sn);
23
- };
22
+ };
24
23
 
25
- }; // namespace Wishlist
24
+ }; // namespace Wishlist
@@ -56,6 +56,12 @@ function createTemplateValue(mapper) {
56
56
  function isTemplateValue(value) {
57
57
  return value !== null && typeof value === 'object' && value.__isTemplateValue === true;
58
58
  }
59
+
60
+ /**
61
+ * The `mapper` runs on the UI worklet runtime. Mark it (and any nested function
62
+ * literals it passes to helpers like `Array#reduce`) with a leading
63
+ * `'worklet';` statement so `react-native-worklets-core` can compile them.
64
+ */
59
65
  function useTemplateValue(mapper) {
60
66
  const value = (0, _react.useMemo)(() => {
61
67
  return createTemplateValue(mapper);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_InflatorRepository","_Utils","_WishlistJsRuntime","createTemplateValue","mapper","id","generateId","getOrCreateUIState","registry","getUIInflatorRegistry","state","getTemplateValueState","dirty","current","undefined","setTemplateValueState","value","getCurrentValue","getCurrentRootValue","remove","createRunInWishlistFn","deleteTemplateValueState","__isTemplateValue","__remove","isTemplateValue","useTemplateValue","useMemo","useEffect"],"sourceRoot":"../../src","sources":["TemplateValue.tsx"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAOA;AACA;;AAeO,SAASI,mBAAmBA,CACjCC,MAAwC,EACT;EAC/B,MAAMC,EAAE,GAAG,IAAAC,iBAAU,EAAC,CAAC;EAEvB,SAASC,kBAAkBA,CAAA,EAAG;IAC5B,SAAS;;IAET,MAAMC,QAAQ,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACxC,IAAIC,KAAK,GAAGF,QAAQ,CAACG,qBAAqB,CAACN,EAAE,CAAC;IAC9C,IAAI,CAACK,KAAK,EAAE;MACVA,KAAK,GAAG;QACNE,KAAK,EAAE,IAAI;QACXC,OAAO,EAAEC;MACX,CAAC;MACDN,QAAQ,CAACO,qBAAqB,CAACV,EAAE,EAAEK,KAAK,CAAC;IAC3C;IAEA,OAAOA,KAAK;EACd;EAEA,SAASM,KAAKA,CAAA,EAAG;IACf,SAAS;;IAET,MAAMR,QAAQ,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACxC,MAAMC,KAAK,GAAGH,kBAAkB,CAAC,CAAC;IAClC,IAAIG,KAAK,CAACE,KAAK,EAAE;MACfF,KAAK,CAACG,OAAO,GAAGT,MAAM,CACpBI,QAAQ,CAACS,eAAe,CAAC,CAAC,EAC1BT,QAAQ,CAACU,mBAAmB,CAAC,CAC/B,CAAC;MACDR,KAAK,CAACE,KAAK,GAAG,KAAK;IACrB;IAEA,OAAOF,KAAK,CAACG,OAAO;EACtB;EAEA,SAASM,MAAMA,CAAA,EAAG;IAChB,IAAAC,wCAAqB,EAAC,MAAM;MAC1B,SAAS;;MAET,IAAAX,yCAAqB,EAAC,CAAC,CAACY,wBAAwB,CAAChB,EAAE,CAAC;IACtD,CAAC,CAAC;EACJ;EAEA,OAAO;IACLiB,iBAAiB,EAAE,IAAI;IACvBC,QAAQ,EAAEJ,MAAM;IAChBH;EACF,CAAC;AACH;AAEO,SAASQ,eAAeA,CAC7BR,KAAc,EACuB;EACrC,OACEA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACxBA,KAAK,CAASM,iBAAiB,KAAK,IAAI;AAE7C;AAEO,SAASG,gBAAgBA,CAC9BrB,MAA0C,EACnB;EACvB,MAAMY,KAAK,GAAG,IAAAU,cAAO,EAAC,MAAM;IAC1B,OAAOvB,mBAAmB,CAACC,MAAM,CAAC;EACpC,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,IAAAuB,gBAAS,EAAC,MAAM;IACd,OAAO,MAAMX,KAAK,CAACO,QAAQ,CAAC,CAAC;EAC/B,CAAC,EAAE,CAACP,KAAK,CAAC,CAAC;EAEX,OAAOA,KAAK;AACd","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_InflatorRepository","_Utils","_WishlistJsRuntime","createTemplateValue","mapper","id","generateId","getOrCreateUIState","registry","getUIInflatorRegistry","state","getTemplateValueState","dirty","current","undefined","setTemplateValueState","value","getCurrentValue","getCurrentRootValue","remove","createRunInWishlistFn","deleteTemplateValueState","__isTemplateValue","__remove","isTemplateValue","useTemplateValue","useMemo","useEffect"],"sourceRoot":"../../src","sources":["TemplateValue.tsx"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAOA;AACA;;AAeO,SAASI,mBAAmBA,CACjCC,MAAwC,EACT;EAC/B,MAAMC,EAAE,GAAG,IAAAC,iBAAU,EA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ACnB;EACvB,MAAMY,KAAK,GAAG,IAAAU,cAAO,EAAC,MAAM;IAC1B,OAAOvB,mBAAmB,CAACC,MAAM,CAAC;EACpC,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,IAAAuB,gBAAS,EAAC,MAAM;IACd,OAAO,MAAMX,KAAK,CAACO,QAAQ,CAAC,CAAC;EAC/B,CAAC,EAAE,CAACP,KAAK,CAAC,CAAC;EAEX,OAAOA,KAAK;AACd","ignoreList":[]}
@@ -51,6 +51,12 @@ export function createTemplateValue(mapper) {
51
51
  export function isTemplateValue(value) {
52
52
  return value !== null && typeof value === 'object' && value.__isTemplateValue === true;
53
53
  }
54
+
55
+ /**
56
+ * The `mapper` runs on the UI worklet runtime. Mark it (and any nested function
57
+ * literals it passes to helpers like `Array#reduce`) with a leading
58
+ * `'worklet';` statement so `react-native-worklets-core` can compile them.
59
+ */
54
60
  export function useTemplateValue(mapper) {
55
61
  const value = useMemo(() => {
56
62
  return createTemplateValue(mapper);
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useMemo","getUIInflatorRegistry","generateId","createRunInWishlistFn","createTemplateValue","mapper","id","getOrCreateUIState","registry","state","getTemplateValueState","dirty","current","undefined","setTemplateValueState","value","getCurrentValue","getCurrentRootValue","remove","deleteTemplateValueState","__isTemplateValue","__remove","isTemplateValue","useTemplateValue"],"sourceRoot":"../../src","sources":["TemplateValue.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAC1C,SAASC,qBAAqB,QAAQ,sBAAsB;AAC5D,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,qBAAqB,QAAQ,qBAAqB;;AAO3D;AACA;;AAeA,OAAO,SAASC,mBAAmBA,CACjCC,MAAwC,EACT;EAC/B,MAAMC,EAAE,GAAGJ,UAAU,CAAC,CAAC;EAEvB,SAASK,kBAAkBA,CAAA,EAAG;IAC5B,SAAS;;IAET,MAAMC,QAAQ,GAAGP,qBAAqB,CAAC,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ZN,SAAS,CAAC,MAAM;IACd,OAAO,MAAMgB,KAAK,CAACM,QAAQ,CAAC,CAAC;EAC/B,CAAC,EAAE,CAACN,KAAK,CAAC,CAAC;EAEX,OAAOA,KAAK;AACd","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useMemo","getUIInflatorRegistry","generateId","createRunInWishlistFn","createTemplateValue","mapper","id","getOrCreateUIState","registry","state","getTemplateValueState","dirty","current","undefined","setTemplateValueState","value","getCurrentValue","getCurrentRootValue","remove","deleteTemplateValueState","__isTemplateValue","__remove","isTemplateValue","useTemplateValue"],"sourceRoot":"../../src","sources":["TemplateValue.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAC1C,SAASC,qBAAqB,QAAQ,sBAAsB;AAC5D,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,qBAAqB,QAAQ,qBAAqB;;AAO3D;AACA;;AAeA,OAAO,SAASC,mBAAmBA,CACjCC,MAAwC,EACT;EAC/B,MAAMC,EAAE,GAAGJ,UAAU,CAAC,CAAC;EAEvB,SAASK,kBAAkBA,CAAA,EAAG;IAC5B,SAAS;;IAET,MAAMC,QAAQ,GAAGP,qBAAqB,CAAC,CAAC;IACxC,IAAIQ,KAAK,GAAGD,QAAQ,CAACE,qBAAqB,CAACJ,EAAE,CAAC;IAC9C,IAAI,CAACG,KAAK,EAAE;MACVA,KAAK,GAAG;QACNE,KAAK,EAAE,IAAI;QACXC,OAAO,EAAEC;MACX,CAAC;MACDL,QAAQ,CAACM,qBAAqB,CAACR,EAAE,EAAEG,KAAK,CAAC;IAC3C;IAEA,OAAOA,KAAK;EACd;EAEA,SAASM,KAAKA,CAAA,EAAG;IACf,SAAS;;IAET,MAAMP,QAAQ,GAAGP,qBAAqB,CAAC,CAAC;IACxC,MAAMQ,KAAK,GAAGF,kBAAkB,CAAC,CAAC;IAClC,IAAIE,KAAK,CAACE,KAAK,EAAE;MACfF,KAAK,CAACG,OAAO,GAAGP,MAAM,CACpBG,QAAQ,CAACQ,eAAe,CAAC,CAAC,EAC1BR,QAAQ,CAACS,mBAAmB,CAAC,CAC/B,CAAC;MACDR,KAAK,CAACE,KAAK,GAAG,KAAK;IACrB;IAEA,OAAOF,KAAK,CAACG,OAAO;EACtB;EAEA,SAASM,MAAMA,CAAA,EAAG;IAChBf,qBAAqB,CAAC,MAAM;MAC1B,SAAS;;MAETF,qBAAqB,CAAC,CAAC,CAACkB,wBAAwB,CAACb,EAAE,CAAC;IACtD,CAAC,CAAC;EACJ;EAEA,OAAO;IACLc,iBAAiB,EAAE,IAAI;IACvBC,QAAQ,EAAEH,MAAM;IAChBH;EACF,CAAC;AACH;AAEA,OAAO,SAASO,eAAeA,CAC7BP,KAAc,EACuB;EACrC,OACEA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACxBA,KAAK,CAASK,iBAAiB,KAAK,IAAI;AAE7C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,gBAAgBA,CAC9BlB,MAA0C,EACnB;EACvB,MAAMU,KAAK,GAAGf,OAAO,CAAC,MAAM;IAC1B,OAAOI,mBAAmB,CAACC,MAAM,CAAC;EACpC,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZN,SAAS,CAAC,MAAM;IACd,OAAO,MAAMgB,KAAK,CAACM,QAAQ,CAAC,CAAC;EAC/B,CAAC,EAAE,CAACN,KAAK,CAAC,CAAC;EAEX,OAAOA,KAAK;AACd","ignoreList":[]}
@@ -12,5 +12,10 @@ export type TemplateValueInternal<ValueT> = TemplateValue<ValueT> & {
12
12
  };
13
13
  export declare function createTemplateValue<ValueT>(mapper: TemplateValueMapper<any, ValueT>): TemplateValueInternal<ValueT>;
14
14
  export declare function isTemplateValue(value: unknown): value is TemplateValueInternal<any>;
15
+ /**
16
+ * The `mapper` runs on the UI worklet runtime. Mark it (and any nested function
17
+ * literals it passes to helpers like `Array#reduce`) with a leading
18
+ * `'worklet';` statement so `react-native-worklets-core` can compile them.
19
+ */
15
20
  export declare function useTemplateValue<ItemT, ValueT>(mapper: TemplateValueMapper<ItemT, ValueT>): TemplateValue<ValueT>;
16
21
  //# sourceMappingURL=TemplateValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateValue.d.ts","sourceRoot":"","sources":["../../src/TemplateValue.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,CAAC,KAAK,EAAE,MAAM,IAAI,CAC/C,IAAI,EAAE,KAAK,EACX,SAAS,EAAE,GAAG,KACX,MAAM,CAAC;AAIZ,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI;IAClC,KAAK,EAAE,MAAM,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG;IAClE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,MAAM,EAAE,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,GACvC,qBAAqB,CAAC,MAAM,CAAC,CAgD/B;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAMrC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAC5C,MAAM,EAAE,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,GACzC,aAAa,CAAC,MAAM,CAAC,CAUvB"}
1
+ {"version":3,"file":"TemplateValue.d.ts","sourceRoot":"","sources":["../../src/TemplateValue.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,CAAC,KAAK,EAAE,MAAM,IAAI,CAC/C,IAAI,EAAE,KAAK,EACX,SAAS,EAAE,GAAG,KACX,MAAM,CAAC;AAIZ,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI;IAClC,KAAK,EAAE,MAAM,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG;IAClE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,MAAM,EAAE,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,GACvC,qBAAqB,CAAC,MAAM,CAAC,CAgD/B;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAMrC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAC5C,MAAM,EAAE,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,GACzC,aAAa,CAAC,MAAM,CAAC,CAUvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leonsilicon/react-native-wishlist",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "The fastest List component for React Native updated to work with Expo 55",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -86,6 +86,11 @@ export function isTemplateValue(
86
86
  );
87
87
  }
88
88
 
89
+ /**
90
+ * The `mapper` runs on the UI worklet runtime. Mark it (and any nested function
91
+ * literals it passes to helpers like `Array#reduce`) with a leading
92
+ * `'worklet';` statement so `react-native-worklets-core` can compile them.
93
+ */
89
94
  export function useTemplateValue<ItemT, ValueT>(
90
95
  mapper: TemplateValueMapper<ItemT, ValueT>,
91
96
  ): TemplateValue<ValueT> {