Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.pbxproj -text
# specific for windows script files
*.bat text eol=crlf
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release to NPM

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
run: npm ci

- name: Build package
run: |
if node -e "process.exit(require('./package.json').scripts?.build ? 0 : 1)"; then npm run build; fi

- name: Publish to NPM
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Validate

on:
pull_request:
branches: [main, master, development]
push:
branches: [main, master, development]

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linting
run: |
if node -e "process.exit(require('./package.json').scripts?.lint ? 0 : 1)"; then npm run lint; fi

- name: Run tests
run: |
if node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)"; then npm test; fi

- name: Run build
run: |
if node -e "process.exit(require('./package.json').scripts?.build ? 0 : 1)"; then npm run build; fi
78 changes: 78 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# OSX
#
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
jsconfig.json

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
**/.xcode.env.local

# Android/IJ
#
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml

# Cocoapods
#
example/ios/Pods

# Ruby
example/vendor/

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Expo
.expo/

# Turborepo
.turbo/

# generated by bob
lib/

# React Native Codegen
ios/generated
android/generated

# React Native Nitro Modules
nitrogen/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.20.0
10 changes: 10 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
printWidth: 120,
arrowParens: 'always',
tabWidth: 2,
semi: true,
bracketSameLine: true,
jsxSingleQuote: true,
singleQuote: true,
useTabs: false,
};
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
127 changes: 127 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Contributing

This document provides guidelines for contributing to this project.

## Development

### Prerequisites

- Node.js 22+
- npm
- For iOS: Xcode + CocoaPods (`gem install cocoapods`)
- For Android: Android Studio + JDK 17+

### Example app

An example React Native application lives in the `example` directory. It demonstrates the component in action and serves as a testing ground during development.

Run the Metro bundler from the repo root:

```sh
npm run example
```

Then launch the app on your target platform from the `example` directory:

```sh
# iOS
cd example && npx react-native run-ios

# Android
cd example && npx react-native run-android
```

For iOS, install CocoaPods first:

```sh
cd example/ios && bundle exec pod install
```

### Local development

1. **Clone and install dependencies**
- Clone the repo and navigate to the project directory
- Run `npm install` to install all dependencies

```sh
git clone https://github.com/RonasIT/react-native-controlled-input.git
cd react-native-controlled-input
npm install
```

2. **Make changes**
- Edit source files under `src/`
- For native changes, edit files under `ios/` or `android/`

3. **Test your changes**
- Run `npm run lint` to type-check (`tsc`) and lint the codebase (`eslint`)
- Verify your changes work end-to-end in the example app

4. **Submit changes**
- Create a pull request with your modifications
- Include clear descriptions of changes
- Reference any related issues or discussions

## Build

Build the JS output (outputs to `lib/`):

```sh
npm run build
```

This runs `react-native-builder-bob` and produces ESM + TypeScript declaration files.

To clean build artifacts:

```sh
npm run clean
```

## Repository guidelines

### Branch naming

Use descriptive branch names and follow [Conventional Branch](https://conventional-branch.github.io/) guidelines.

### Commit messages

Follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format

### Code checks

Repository has pre-commit code style and correctness checks. You can run them manually using `lint` and `format` scripts.

### Pull request process

1. **Create a feature branch** from `main`
2. **Make your changes** following the coding standards
3. **Test your changes** thoroughly
4. **Update documentation** if needed
5. **Submit a pull request** with a clear description

## Releases

To create a new release:

1. **Bump the version**: In the `plugin` directory run `npm version {patch|minor|major}` to update the version number in `package.json` and create a git commit and tag
- `patch`: Bug fixes (0.2.0 → 0.2.1)
- `minor`: New features (0.2.0 → 0.3.0)
- `major`: Breaking changes (0.2.0 → 1.0.0)

2. **Push changes**: Create commit, tag and push them to the repository:

```bash
git commit -m "chore: release v0.18.0"
git push && git push --tags
```

3. **Create GitHub release**: Go to the [GitHub Releases](../../releases) page and:
- Click "Create a new release"
- Select the tag created in step 1
- Add release notes describing the changes
- Click "Publish release"

4. **Automatic NPM publication**: Once the GitHub release is published, the package will be automatically published to NPM via GitHub Actions workflow.

> **Note**: Make sure you have the `NPM_TOKEN` secret configured in your repository settings for the NPM publication to work.
20 changes: 20 additions & 0 deletions ControlledInput.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = "ControlledInput"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]

s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/RonasIT/react-native-controlled-input.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
s.private_header_files = "ios/**/*.h"

install_modules_dependencies(s)
end
Loading