-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bara): new operators and change hook function name (#20)
fix(bara): new operators and change hook function name
- Loading branch information
Showing
30 changed files
with
763 additions
and
456 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
{ | ||
"extends": [ | ||
"config:base" | ||
] | ||
], | ||
"packageRules": [ | ||
{ | ||
"packageName": ["bara"], | ||
"groupName": "bara packages", | ||
"pin": false, | ||
"automerge": true | ||
} | ||
], | ||
"automerge": true, | ||
"major": { | ||
"automerge": false | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { BaraReactText, TextPressEventFilter } from './event' | ||
import { kindOf, nameOf } from '../../functions/common' | ||
|
||
export const nameOfText = (name: string) => (triggeringEvent: BaraReactText): boolean => | ||
name ? name === triggeringEvent.name : true | ||
export const nameOfText = nameOf | ||
|
||
export const kindOfText = kindOf |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,45 @@ | ||
import { TextPressEventFilter } from './event' | ||
import { | ||
ActionPipe, | ||
BaraEventPayload, | ||
ConditionPipe, | ||
createPipe, | ||
useAction, | ||
useCondition, | ||
useEvent, | ||
useTrigger, | ||
} from 'bara' | ||
|
||
import { BaraReactText, useTextLongPressEvent, useTextPressEvent } from './event' | ||
import { TextPressCallback, useTextPressTrigger } from './trigger' | ||
|
||
export function useTextPress( | ||
eventFilter: TextPressEventFilter, | ||
callback: TextPressCallback, | ||
) { | ||
return useTextPressTrigger(eventFilter, callback) | ||
export const whenTextPress = ( | ||
...conditions: Array<ConditionPipe<BaraReactText>> | ||
) => (...actions: Array<ActionPipe<BaraReactText>>) => { | ||
const piper = ( | ||
data: BaraReactText, | ||
payload: BaraEventPayload<BaraReactText>, | ||
) => { | ||
createPipe(data, payload)(...(conditions as any))(...actions) | ||
} | ||
useTrigger<BaraReactText>(() => { | ||
const event = useTextPressEvent() | ||
const action = useAction(piper) | ||
return { event, action } | ||
}) | ||
} | ||
|
||
export const whenTextLongPress = ( | ||
...conditions: Array<ConditionPipe<BaraReactText>> | ||
) => (...actions: Array<ActionPipe<BaraReactText>>) => { | ||
const piper = ( | ||
data: BaraReactText, | ||
payload: BaraEventPayload<BaraReactText>, | ||
) => { | ||
createPipe(data, payload)(...(conditions as any))(...actions) | ||
} | ||
useTrigger<BaraReactText>(() => { | ||
const event = useTextLongPressEvent() | ||
const action = useAction(piper) | ||
return { event, action } | ||
}) | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import { BaraReactTouchable, TouchableEventFilter } from './event' | ||
import { kindOf, nameOf } from '../../functions/common' | ||
|
||
export const nameOfTouchable = (name: string) => (triggeringEvent: BaraReactTouchable): boolean => | ||
name ? name === triggeringEvent.name : true | ||
export const nameOfTouchable = nameOf | ||
|
||
export const classOfTouchable = (className: string) => ( | ||
triggeringEvent: BaraReactTouchable, | ||
): boolean => (className ? className === triggeringEvent.className : true) | ||
export const kindOfTouchable = kindOf |
This file contains 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
Oops, something went wrong.