Skip to content

Commit 0b87e63

Browse files
author
Matej Mazur
committed
Update FieldTemplate.js: export internal components so you can reuse them
1 parent a573096 commit 0b87e63

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/components/templates/FieldTemplate.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,21 @@ if (process.env.NODE_ENV !== "production") {
6464
displayLabel: PropTypes.bool,
6565
fields: PropTypes.object,
6666
formContext: PropTypes.object,
67+
registry: PropTypes.shape({
68+
widgets: PropTypes.objectOf(
69+
PropTypes.oneOfType([PropTypes.func, PropTypes.object])
70+
).isRequired,
71+
templates: PropTypes.objectOf(
72+
PropTypes.oneOfType([PropTypes.func, PropTypes.object])
73+
).isRequired,
74+
fields: PropTypes.objectOf(PropTypes.func).isRequired,
75+
definitions: PropTypes.object.isRequired,
76+
formContext: PropTypes.object.isRequired,
77+
}),
6778
};
6879
}
6980

70-
function Label(props) {
81+
export function Label(props) {
7182
const { label, required, id } = props;
7283
if (!label) {
7384
// See #312: Ensure compatibility with old versions of React.
@@ -81,7 +92,7 @@ function Label(props) {
8192
);
8293
}
8394

84-
function Help(props) {
95+
export function Help(props) {
8596
const { help } = props;
8697
if (!help) {
8798
// See #312: Ensure compatibility with old versions of React.
@@ -93,7 +104,7 @@ function Help(props) {
93104
return <div className="help-block">{help}</div>;
94105
}
95106

96-
function ErrorList(props) {
107+
export function ErrorList(props) {
97108
const { errors = [] } = props;
98109
if (errors.length === 0) {
99110
return <div />;

0 commit comments

Comments
 (0)