Deep overhaul: TypeScript + builder-bob, real tests/CI, bug fixes, modern docs (recommend v1.0.0)#37
Open
kuraydev wants to merge 6 commits into
Open
Deep overhaul: TypeScript + builder-bob, real tests/CI, bug fixes, modern docs (recommend v1.0.0)#37kuraydev wants to merge 6 commits into
kuraydev wants to merge 6 commits into
Conversation
- Convert lib/src JS to typed src/*.tsx|ts with exported prop interfaces
(HeaderSearchBarProps, HeaderClassicSearchBarProps, SearchBoxProps)
- Drop PropTypes/defaultProps in favor of typed default parameters
- Wrap components in React.memo + React.forwardRef
- Fix implicit global: renderTextInput is now a local const (SearchBox)
- Fix secondTitleFontSize being ignored (was hard-coded to 18)
- Replace removed useSafeArea() with useSafeAreaInsets()
- Stop spreading {...props} onto Icon/Ripple/View; keep SearchBox passthrough
- Add accessibility roles/labels
- Point example app import at the package root
- Compile to lib/ (commonjs + module + typescript) via react-native-builder-bob - main/module/react-native/source/types + exports map; bare import resolves, deep lib/src imports removed (breaking, documented) - files allowlist (src, lib, docs only) - Add scripts: build, clean, typecheck, lint, test, prepare, prepack - peerDependencies widened with peerDependenciesMeta; add the previously undeclared react-native-material-ripple; raise safe-area-context floor to >=3 - Repoint repository/homepage/bugs URLs to kuraydev - gitignore generated lib/ and coverage/; add tsconfig(.build).json + babel config
- Replace deprecated babel-eslint/airbnb .eslintrc with eslint.config.js (typescript-eslint + eslint-plugin-react + prettier) - Add .prettierrc/.prettierignore (README advertised prettier with no config) - Add jest.setup.js virtual-mocking the native peer deps
- ci.yml runs install + lint + typecheck + test + build on Node 18/20/22 - dependabot now watches root, example and github-actions
- Accurate props/API tables, full peer-dep install line incl. material-ripple - TypeScript, New Architecture/Expo, SafeAreaProvider and migration notes - Fix badges/links to kuraydev; drop stale 2019 sections - Add CHANGELOG (Keep a Changelog), CONTRIBUTING, issue/PR templates
2f875b3 to
35ee4d5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review fixes applied: bumped
package.jsonto1.0.0and converted the CHANGELOG## [Unreleased]section to## [1.0.0] - 2026-06-29(with matching compare link) per reviewer request before ship.Summary
This is a full modernization of a ~6-year-stale (last publish
0.1.10, 2020) pure-JS React Native component library. It migrates the source to TypeScript, introduces a real build pipeline, adds a test suite + CI, fixes several genuine bugs, and rewrites the docs — without changing the public API (namedHeaderSearchBar/HeaderClassicSearchBarexports, the default object export, and every prop name + runtime default are preserved).Because the published output layout and peer floors change, this ships as a major bump to
1.0.0.Non-breaking improvements
Bug fixes (pure, behavior-correcting)
secondTitleFontSizeis now honored — the style hardcodedfontSize: 18and ignored the prop. Default remains18.SearchBox.renderTextInputis now aconstlocal; it previously leaked an implicit global on every render.{...props}onto native elements (Androw,View,Icon,Ripple), which forwarded unknown props and caused warnings. Intended props are passed explicitly; search props still forward to the internalSearchBox.accessibilityRoleto the search container and hamburger button.Tooling & quality
react-native-builder-bobbuild (CommonJS + ESM + TypeScript declarations);main/module/types/react-native/source/exports+filesallowlist. Verified the built CJS entry still exposes named + default exports andnpm packproduces a clean 60-file tarball (no tests/example).React.memo; moved static styles intoStyleSheet.create.typescript-eslint(replacing deadairbnb+babel-eslint) and a real Prettier config (the README advertised a Prettier badge with no config).react-native-material-ripplepeer (optional viapeerDependenciesMeta); widened peer ranges.@testing-library/react-nativesuite — 15 tests across both header variants andSearchBox./example, andgithub-actions.WrathChaos/freakycoder.comtokuraydev.SafeAreaProvidersetup, fixed badges/links); addedCHANGELOG.md,CONTRIBUTING.md, issue/PR templates./exampleapp to import from the package and render both variants (not deleted).Breaking changes (recommend v1.0.0 major)
lib/src/*.jsto a compiledlib/build. Deep imports likereact-native-header-search-bar/lib/src/...no longer resolve — import from the package root. The package-root import shape is unchanged.react >=16.8.0,react-native >=0.60.0,react-native-safe-area-context >=3.0.0(theuseSafeArea()->useSafeAreaInsets()fix;useSafeAreawas removed in safe-area-context v3).prop-types/defaultPropsremoved in favor of TypeScript types + default parameters. Runtime prop validation is gone;prop-typesis no longer a dependency.secondTitleFontSizeno longer a no-op and native elements no longer receive the blind{...props}spread — subtle rendering changes for anyone who depended on the old broken behavior.Migration is a no-op for typical consumers importing from the package root on a modern RN; see
CHANGELOG.mdfor details.Intentionally preserved (to avoid visual regressions)
react-native-androw(Android shadow) and@freakycoder/react-native-helpers(notch/status-bar math) are kept rather than swapped forelevation/boxShadowor safe-area math, since replacing them changes pixels for current users. Their abandoned-dependency / New-Arch risk is documented in the README/CHANGELOG instead.New Architecture
Added an explicit compatibility statement: the package contains no native code of its own, so it works on the old and new architecture; New-Arch readiness depends on the app's native peer deps. Expo support documented (Dev Client / prebuild, not Expo Go).
Verification
Run against
./node_modules/.binbinaries directly (the rtk shell proxy intercepts baretsc/eslint/jestwith a stale resolver and reports false errors):npm install --no-audit --no-fundprepare/bob build cleantsc --noEmit -p tsconfig.json(TS 5.9.3)eslint "src/**/*.{ts,tsx}"jest --cibob buildnpm pack --dry-runNative peer deps are intentionally not installed (typed via ambient declarations, virtually mocked in tests); CI re-validates on clean runners via
npm ci(lockfile committed).Notes
/exampleand are out of scope here.refactor!,test,ci,docs.