forked from prscX/react-native-spruce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
214 additions
and
16 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
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,6 +1,2 @@ | ||
|
||
import { NativeModules } from 'react-native'; | ||
|
||
const { RNSpruce } = NativeModules; | ||
|
||
export default RNSpruce; | ||
export * from './js' |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
import { NativeModules, findNodeHandle } from 'react-native' | ||
const { RNSpruce } = NativeModules; | ||
|
||
class Spruce { | ||
} | ||
|
||
Spruce.SpruceBuilder = (view) => { | ||
this.view = findNodeHandle(view) | ||
|
||
return { | ||
sortWith: (sortWith) => { | ||
this.sortWith = sortWith.toJSON() | ||
}, | ||
|
||
start: () => { | ||
RNSpruce.StartAnimator( | ||
this.view, | ||
this.sortWith | ||
) | ||
} | ||
} | ||
} | ||
|
||
export { Spruce }; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './sort' | ||
|
||
export * from './Spruce' |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
class CorneredSort { | ||
static Corner = { | ||
TOP_LEFT: "TOP_LEFT", | ||
TOP_RIGHT: "TOP_RIGHT", | ||
BOTTOM_RIGHT: "BOTTOM_RIGHT", | ||
BOTTOM_RIGHT: "BOTTOM_RIGHT" | ||
}; | ||
|
||
constructor(interObjectDelay, reversed, corner) { | ||
this.interObjectDelay = interObjectDelay | ||
this.reversed = reversed | ||
this.corner = corner | ||
|
||
if (this.interObjectDelay === undefined) this.interObjectDelay = "50" | ||
if (this.reversed === undefined) this.reversed = "false" | ||
if (this.corner === undefined) this.corner = CorneredSort.Corner.TOP_LEFT; | ||
} | ||
|
||
toJSON() { | ||
return { name: 'CorneredSort', interObjectDelay: this.interObjectDelay, reversed: this.reversed, corner: this.corner }; | ||
} | ||
} | ||
|
||
export { CorneredSort }; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
const SORT = 'DefaultSort' | ||
|
||
class DefaultSort { | ||
constructor(interObjectDelay) { | ||
this.interObjectDelay = interObjectDelay | ||
|
||
if (this.interObjectDelay === undefined) this.interObjectDelay = "50" | ||
} | ||
|
||
toJSON() { | ||
return { name: 'DefaultSort', interObjectDelay: this.interObjectDelay } | ||
} | ||
} | ||
|
||
export { DefaultSort } |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
class LinearSort { | ||
static Direction = { | ||
TOP_TO_BOTTOM: "TOP_TO_BOTTOM", | ||
BOTTOM_TO_TOP: "BOTTOM_TO_TOP", | ||
LEFT_TO_RIGHT: "LEFT_TO_RIGHT", | ||
RIGHT_TO_LEFT: "RIGHT_TO_LEFT" | ||
}; | ||
|
||
constructor(interObjectDelay, reversed, direction) { | ||
this.interObjectDelay = interObjectDelay; | ||
this.reversed = reversed; | ||
this.direction = direction; | ||
|
||
if (this.interObjectDelay === undefined) this.interObjectDelay = "50"; | ||
if (this.reversed === undefined) this.reversed = "false"; | ||
if (this.direction === undefined) this.direction = LinearSort.Direction.TOP_TO_BOTTOM; | ||
} | ||
|
||
toJSON() { | ||
return { name: "LinearSort", interObjectDelay: this.interObjectDelay, reversed: this.reversed, direction: this.direction }; | ||
} | ||
} | ||
|
||
export { LinearSort } |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
class RadialSort { | ||
static Position = { | ||
TOP_LEFT: "TOP_LEFT", | ||
TOP_MIDDLE: "TOP_MIDDLE", | ||
TOP_RIGHT: "TOP_RIGHT", | ||
LEFT: "LEFT", | ||
MIDDLE: "MIDDLE", | ||
RIGHT: "RIGHT", | ||
BOTTOM_LEFT: "BOTTOM_LEFT", | ||
BOTTOM_MIDDLE: "BOTTOM_MIDDLE", | ||
BOTTOM_RIGHT: "BOTTOM_RIGHT" | ||
}; | ||
|
||
constructor(interObjectDelay, reversed, position) { | ||
this.interObjectDelay = interObjectDelay | ||
this.reversed = reversed | ||
this.position = position | ||
|
||
if (this.interObjectDelay === undefined) this.interObjectDelay = "50"; | ||
if (this.reversed === undefined) this.reversed = "false"; | ||
if (this.position === undefined) this.position = RadialSort.Position.TOP_LEFT; | ||
} | ||
|
||
toJSON() { | ||
return { name: "RadialSort", interObjectDelay: this.interObjectDelay, reversed: this.reversed, position: this.position }; | ||
} | ||
} | ||
|
||
export { RadialSort } |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
class RandomSort { | ||
constructor(interObjectDelay) { | ||
this.interObjectDelay = interObjectDelay | ||
|
||
if (this.interObjectDelay === undefined) this.interObjectDelay = "50"; | ||
} | ||
|
||
toJSON() { | ||
return { interObjectDelay: this.interObjectDelay } | ||
} | ||
} | ||
|
||
export { RandomSort } |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
export * from './CorneredSort' | ||
export * from './DefaultSort' | ||
export * from './LinearSort' | ||
export * from './RadialSort' | ||
export * from './RandomSort' |