Skip to content

Commit 735f146

Browse files
Initial public release: v0.2.0
- Modern Play App Update SDK 2.x on Android (IMMEDIATE flow) - Pure-JS iOS modal with iOS / Liquid Glass aesthetic - Server-driven version thresholds (min + latest) - TypeScript-first, React hooks API, themeable via accent prop - SuggestUpdateBanner: dismiss × button + swipe-to-dismiss gesture - 33 Jest tests, strict TypeScript, ESM + CommonJS dual build
0 parents  commit 735f146

36 files changed

Lines changed: 7676 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Lint, typecheck, test, build
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Node
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'yarn'
21+
22+
- name: Install dependencies
23+
run: yarn install --frozen-lockfile
24+
25+
- name: Typecheck
26+
run: yarn typecheck
27+
28+
- name: Run tests
29+
run: yarn test --ci
30+
31+
- name: Build
32+
run: yarn build
33+
34+
- name: Verify tarball contents
35+
run: npm pack --dry-run

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
name: Publish to npm
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'yarn'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
27+
28+
- name: Typecheck
29+
run: yarn typecheck
30+
31+
- name: Run tests
32+
run: yarn test --ci
33+
34+
- name: Build
35+
run: yarn build
36+
37+
- name: Publish to npm
38+
run: npm publish --access public --provenance
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
node_modules/
2+
lib/
3+
coverage/
4+
5+
# macOS
6+
.DS_Store
7+
8+
# IDEs
9+
.idea/
10+
.vscode/
11+
*.iml
12+
13+
# Logs
14+
*.log
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
19+
# Android
20+
android/.gradle/
21+
android/build/
22+
android/local.properties
23+
android/*.keystore
24+
25+
# iOS
26+
ios/build/
27+
ios/Pods/
28+
ios/Podfile.lock
29+
30+
# Example
31+
example/ios/Pods/
32+
example/android/.gradle/
33+
example/android/build/
34+
example/node_modules/
35+
36+
# Env
37+
.env
38+
.env.local

.npmignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Everything that should NOT ship in the npm tarball.
2+
# `files` in package.json is the allowlist; this is a belt-and-braces denylist.
3+
4+
__tests__/
5+
example/
6+
docs/
7+
coverage/
8+
.github/
9+
.gitignore
10+
.eslintrc*
11+
.prettierrc*
12+
jest.config.js
13+
babel.config.js
14+
tsconfig.json
15+
tsconfig.build.json
16+
*.log
17+
.DS_Store
18+
19+
# Source maps — not useful to consumers
20+
**/*.map

CHANGELOG.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Changelog
2+
3+
All notable changes to `react-native-update-gate` will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.2.0] — 2026-05-18
11+
12+
### Added
13+
- **`accent` shorthand prop** on `<ForceUpdateModal>` and `<SuggestUpdateBanner>`.
14+
Override just the primary colour without spreading a full theme object:
15+
```tsx
16+
<ForceUpdateModal visible={true} accent="#0F62FE" />
17+
```
18+
- **`theme` prop now accepts `Partial<UpdateGateTheme>`** — pass only the
19+
properties you want to override. Merged on top of the context theme + platform default.
20+
- **`createTheme(overrides)` helper** exported for building a complete theme
21+
from partial overrides.
22+
- **`withAlpha(color, alpha)` helper** exported for tinted colour utilities.
23+
- **Built-in default icons** for both components:
24+
- `ForceUpdateModal` ships a 72×72 download-arrow card (``) in tinted accent.
25+
- `SuggestUpdateBanner` ships a 32×32 up-arrow chip (``) in tinted accent.
26+
- Replace either via the new `icon` prop with any ReactNode (SVG, Lottie, Image).
27+
- **Subtle icon bob animation** on the default modal icon (3 px, 1.6 s loop).
28+
- **Optional `@react-native-community/blur` integration** — installs as an
29+
optional peer dependency. When installed, the modal uses a true frosted-glass
30+
backdrop on iOS. Falls back gracefully to a darker scrim when not installed.
31+
32+
### Changed
33+
- Modal redesigned in iOS / Liquid Glass aesthetic: pill button, tinted accent
34+
bar above title, soft floating shadow, tinted version-label pill.
35+
- Banner redesigned with a left accent bar, tinted icon chip, pill action button,
36+
larger close-button hit target.
37+
- Default `radius` bumped from 20 → 24 for softer card corners.
38+
- Default backdrop opacity slightly reduced for a cleaner look.
39+
40+
### Fixed
41+
- `useTheme` now correctly merges partial themes from context + props + accent
42+
shorthand (was previously all-or-nothing).
43+
44+
## [0.1.1] — 2026-05-15
45+
46+
### Fixed
47+
- `<SuggestUpdateBanner>` now handles dismissal internally. Tapping the `×` close
48+
button, tapping the action button, or `autoHideAfter` elapsing all hide the
49+
banner immediately without requiring the consumer to wire `onDismiss` or
50+
track local state. The banner re-appears automatically when the `visible`
51+
prop transitions from `false` back to `true` (e.g. a new release bumps the
52+
`latestAvailable` threshold).
53+
54+
### Changed
55+
- `onDismiss` is now an **optional** callback fired *after* dismissal completes
56+
(for analytics / persistence). Existing consumers that passed it continue to
57+
work unchanged.
58+
59+
## [0.1.0] — 2026-05-15
60+
61+
### Added
62+
- `evaluateUpdate(input)` — pure verdict function (`'force' | 'suggest' | 'none'`).
63+
- `presentUpdate(mode)` — platform-aware UI trigger.
64+
- `configureUpdateGate(config)` — one-time package config.
65+
- `useUpdate(input)` — React hook with `AppState` resume re-check.
66+
- `<ForceUpdateModal>` — animated, themeable, accessible blocking modal for iOS (and Android fallback).
67+
- `<SuggestUpdateBanner>` — dismissible banner for non-critical updates.
68+
- `<UpdateGateThemeProvider>` + `useTheme()` — theming primitives.
69+
- Android native module wrapping Google's Play App Update SDK 2.x (IMMEDIATE flow).
70+
- iOS: zero native code — pure-RN modal + `Linking` deep-link to App Store.
71+
- Server-driven version threshold support (`minRequired` + `latestAvailable`).
72+
- TypeScript types shipped (`strict`, `noUncheckedIndexedAccess`).
73+
- ESM + CommonJS dual build via `react-native-builder-bob`.
74+
- Jest test suite covering verdict matrix, config, and hook.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 SABA Hospitality
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)