@tamagui/use-force-update 1.0.0-alpha.16 → 1.0.0-alpha.23

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/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@tamagui/use-force-update",
3
- "version": "1.0.0-alpha.16",
3
+ "version": "1.0.0-alpha.23",
4
4
  "typings": "types",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
7
7
  "module:jsx": "dist/jsx",
8
8
  "files": [
9
9
  "types",
10
- "src",
11
10
  "dist"
12
11
  ],
13
12
  "scripts": {
@@ -15,13 +14,13 @@
15
14
  "watch": "tamagui-build --watch"
16
15
  },
17
16
  "devDependencies": {
18
- "@tamagui/build": "^1.0.0-alpha.12"
17
+ "@tamagui/build": "^1.0.0-alpha.22"
19
18
  },
20
- "peerDependencies": {
19
+ "dependencies": {
21
20
  "react": "*"
22
21
  },
23
22
  "publishConfig": {
24
23
  "access": "public"
25
24
  },
26
- "gitHead": "f8a5fa567a7d319e33da5f5d27ca7112d394226c"
25
+ "gitHead": "69fb1d82868a6525fee6b0750cb2113d88ffea79"
27
26
  }
package/src/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function useForceUpdate(): Function;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,aAqB7B"}
package/src/index.js DELETED
@@ -1,21 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- export function useForceUpdate() {
3
- const setState = useState(0)[1];
4
- const internal = useRef();
5
- if (!internal.current) {
6
- internal.current = {
7
- isMounted: true,
8
- update: () => {
9
- if (internal.current.isMounted) {
10
- setState(Math.random());
11
- }
12
- },
13
- };
14
- }
15
- useEffect(() => {
16
- return () => {
17
- internal.current.isMounted = false;
18
- };
19
- }, []);
20
- return internal.current.update;
21
- }
package/src/index.ts DELETED
@@ -1,26 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react'
2
-
3
- // ensures no updates after unmount
4
-
5
- export function useForceUpdate() {
6
- const setState = useState(0)[1]
7
- const internal = useRef<{ update: Function; isMounted: boolean }>()
8
- if (!internal.current) {
9
- internal.current = {
10
- isMounted: true,
11
- update: () => {
12
- if (internal.current!.isMounted) {
13
- setState(Math.random())
14
- }
15
- },
16
- }
17
- }
18
-
19
- useEffect(() => {
20
- return () => {
21
- internal.current!.isMounted = false
22
- }
23
- }, [])
24
-
25
- return internal.current.update
26
- }